-
-
Save pandyma/314987e641af3c7d3909685ba8e21b77 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Servo.h> | |
float temp; | |
int tempPin = 0; | |
int cold = 55; | |
int hot = 55.5; | |
int servocold = 100; | |
int servohot = 10; | |
Servo servol; | |
void setup() { | |
Serial.begin(9600); | |
servol.attach(9); | |
} | |
void loop() { | |
temp = analogRead(tempPin); //read temp sensor | |
temp = temp * 0.48828125; | |
Serial.print("TEMPRTATURE = "); | |
Serial.print(temp); | |
Serial.print("*C"); | |
Serial.println(); | |
if(temp < cold){//if temp below cold(20),do this | |
servol.write(servocold); | |
} else if (temp > hot) { | |
servol.write(servohot); | |
} | |
delay(3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment