Ok, maybe I should explain what this is about:
I use the throttle flap to control the air supply of my charcoal grill. The flap is meant to open / close depending of the temperature deviation (and gradient of temperature changes, that's why I think the PID is the right tool). As the temperature will only change slowly when the flap position changes, I want this to happen only once a minute. The main part of the code is:
myPID.Compute();
Input = thermocouple.readCelsius();
if (Input < Setpoint-1){
- myPID.SetControllerDirection(DIRECT);*
- pos=pos+Output;*
- pos=min(pos,180);*
- myservo.write(pos);*
- Serial.print(pos);*
}
else if (Input > Setpoint +1) {
myPID.SetControllerDirection(REVERSE); - pos= pos-Output;*
- pos=max(pos,90);*
myservo.write(pos);
Serial.print(pos);
}
How would I implement interrupt to this?
Axel