#define in1 A0
|
|
#define in2 A1
|
|
#define out1 6
|
|
#define out2 7
|
|
float temp1, lectura1, temp2, lectura2;
|
|
String estado;
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
Serial.begin(9600);
|
|
pinMode(in1, INPUT);
|
|
pinMode(in2, INPUT);
|
|
pinMode(out1, OUTPUT);
|
|
pinMode(out2, OUTPUT);
|
|
}
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
lectura1 = analogRead(in1);
|
|
lectura2 = analogRead(in2);
|
|
temp1 = (lectura1 * 5000 / 1023 / 10) - 33;
|
|
temp2 = (lectura2 * 5000 / 1023 / 10) - 37;
|
|
Serial.println(temp1);
|
|
Serial.println(temp2);
|
|
if(Serial.available()>0){
|
|
estado = Serial.readString();
|
|
if(estado == "on1"){
|
|
digitalWrite(out1, HIGH);
|
|
}
|
|
else if(estado == "off1"){
|
|
digitalWrite(out1, LOW);
|
|
}
|
|
else if(estado == "on2"){
|
|
digitalWrite(out2, HIGH);
|
|
}
|
|
else if(estado == "off2"){
|
|
digitalWrite(out2, LOW);
|
|
}
|
|
}
|
|
|
|
delay(100);
|
|
}
|