Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int thermistorPin = A0;
- const int indicatorPin = 2;
- int sensorValue;
- float temperature;
- void setup() {
- pinMode(LED_BUILTIN, OUTPUT);
- pinMode(indicatorPin, OUTPUT);
- Serial.begin(9600);
- }
- void loop() {
- sensorValue = analogRead(thermistorPin);
- temperature = (sensorValue - 300) * 0.116;
- Serial.println(sensorValue);
- Serial.println(temperature);
- if (temperature < 24) {
- digitalWrite(indicatorPin, HIGH);
- } else if (temperature > 27) {
- digitalWrite(LED_BUILTIN, HIGH);
- }
- delay(2000);
- digitalWrite(indicatorPin, LOW);
- digitalWrite(LED_BUILTIN, LOW);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement