void main() {
while (1) {
current_temp = read_temp();
pid_controller();
if (pid_output > 0) {
MOTOR_PIN = 1; // turn on motor
ARM_PIN = 1; // turn on arm
} else {
MOTOR_PIN = 0; // turn off motor
ARM_PIN = 0; // turn off arm
}
delay(1000); // update every 1 second
}
}
需要根據具體需求修改的地方: