Heating system interface for communication with Arduino and data graphing
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

28 lines
550 B

#define in1 A0
#define out1 6
float temp1, lectura1;
String estado;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(in1, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
lectura1 = analogRead(in1);
temp1 = (lectura1 * 5000 / 1023 / 10) - 40;
Serial.print(temp1);
if(Serial.available()>0){
estado = Serial.readString();
if(estado == "on"){
digitalWrite(out1, HIGH);
}
else if(estado == "off"){
digitalWrite(out1, LOW);
}
}
delay(200);
}