delay(LED_blink_interval); // Keep this status for a certain amount
of time in milliseconds
digitalWrite(BluePin, LOW); // Turn off the blue LED
delay(LED_blink_interval); // Keep this status for a certain amount of time in milliseconds
}
else {
digitalWrite(BluePin, HIGH); // Turn off the blue LED
digitalWrite(GreenPin, LOW); // Turn off the green LED
digitalWrite(RedPin, LOW); // Turn on the red LED
}
}
Here, we define an integer variable called “
LED_blink_interval
” which is inversely
proportional to the deviation of the temperature from the optimal range “
temp_dif.
” A
coefficient 4000 is used here to convert the number to something close to 1000.
Arduino always measures the time duration in millisecond, so delay(1000) means
delay for 1000 millisecond, or 1 second.
Program Part 4.3—Check if the temperature is higher than the optimal
Dostları ilə paylaş: