 
 	temp = getTemperature();
 	pinMode(HEATER_PIN, OUTPUT);
-	heaterOn();
+	heaterOff();
+
+  tempSetPoint = TARGET;
 
 	pid.init();
-	pidDrive = updatePID(&pid, 0, temp);
-#ifdef DUTY_INIT
+	pidDrive = updatePID(&pid, tempSetPoint - temp, temp);
 	heaterDutyCycle = DUTY_INIT;
-#else
-	heaterDutyCycle = pidDrive / 100;
-#endif
 
 	timeZero = millis();
 	sampleTime = millis();			// sample (etc) immediately
 	heaterPeriodTime = millis();	// start new period immediately
 }
 
-#ifdef SET_POINT_MODE
+#ifdef OPEN_LOOP_MODE
 void loop()
 {
 	sampleTimeLeft = sampleTime - millis();

  for (uint8_t i = 0; i<TEMPERATURE_DATA_POINT_COUNT; i++)
    sum += analogRead(TEMP_ADC_PIN);
	return ( sum * 0.0048828125 / (float)TEMPERATURE_DATA_POINT_COUNT - 0.5 ) * 100.0 + 5.0;
}

void heaterOn()

# define DEBUG0(x) (x)
# define DEBUG1(x) PRE; Serial.println(x); POST
# define DEBUG10(x) Serial.print(x); POST
# define DEBUG2(x,y) PRE; Serial.print(x); Serial.println(y); POST
# define DEBUG20(x,y) PRE; Serial.print(x); Serial.print(y); POST
#else
# define DEBUG0(x)
# define DEBUG1(x)
# define DEBUG10(x)
# define DEBUG2(x,y)
# define DEBUG20(x,y)
#endif

#define TEMP_ADC_PIN A3
