From c75300e63bf4c46c8087bc631855191b9c0ed1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Bail=C3=B3n=20Bustos?= Date: Mon, 24 Apr 2023 01:33:44 +0000 Subject: [PATCH] =?UTF-8?q?Actualizaci=C3=B3n=20de=20lectura=20para=202=20?= =?UTF-8?q?sensores?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Se añade el segundo sensor para la lectura de temperatura --- lecturaArduino/lecturaArduino.ino | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lecturaArduino/lecturaArduino.ino b/lecturaArduino/lecturaArduino.ino index 96d91e2..3c2f315 100644 --- a/lecturaArduino/lecturaArduino.ino +++ b/lecturaArduino/lecturaArduino.ino @@ -1,19 +1,25 @@ #define in1 A0 +#define in2 A1 #define out1 6 -float temp1, lectura1; +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); } void loop() { // put your main code here, to run repeatedly: lectura1 = analogRead(in1); - temp1 = (lectura1 * 5000 / 1023 / 10) - 40; - Serial.print(temp1); + 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 + Serial.println(temp1); + Serial.println(temp2); if(Serial.available()>0){ estado = Serial.readString(); if(estado == "on"){