diff --git a/lecturaArduino/lecturaArduino.ino b/lecturaArduino/lecturaArduino.ino index 3c2f315..cf5bb3d 100644 --- a/lecturaArduino/lecturaArduino.ino +++ b/lecturaArduino/lecturaArduino.ino @@ -1,6 +1,7 @@ #define in1 A0 #define in2 A1 #define out1 6 +#define out2 7 float temp1, lectura1, temp2, lectura2; String estado; @@ -10,25 +11,32 @@ void setup() { 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) - 30; - temp2 = (lectura2 * 5000 / 1023 / 10) + 40; //Este debe de ser -40 pero está así para las pruebas + 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 == "on"){ + if(estado == "on1"){ digitalWrite(out1, HIGH); } - else if(estado == "off"){ + else if(estado == "off1"){ digitalWrite(out1, LOW); } + else if(estado == "on2"){ + digitalWrite(out2, HIGH); + } + else if(estado == "off2"){ + digitalWrite(out2, LOW); + } } - delay(200); + delay(100); }