Hola gente, quiero hacer un termómetro con 4 o 5 sondas distintas, todas a distinta entrada analógica y en el monitor quiero ver las temperaturas de cada una.
Soy bien tronco en programación lo hago todo medio en forma intuitiva hice este código
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
const int analogInPin1 = A1;
int sensorValue = 0;
int sensorValue1 = 0;
int outputValue = 0;
int outputValue1 = 0;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
//pinMode (13, OUTPUT);
}
void loop() {
// read the analog in value:
sensorValue = analogRead (analogInPin/1024)*4.9; // convierte a mV
sensorValue1 = analogRead (analogInPin1/1024)*4.9;
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 255);
outputValue1 = map(sensorValue1, 0, 1023, 0, 255);
// change the analog out value:
//analogWrite(analogOutPin, outputValue);
int temperatura = (-.54054*sensorValue+375.675);
int temperatura1 = (-.54054*sensorValue1+375.675);
// print the results to the serial monitor:
Serial.print("Temp0 = " );
//Serial.print (sensorValue);
Serial.print (" ");
Serial.print(temperatura);
//Serial.print(sensorValue);
Serial.print(" Temp1 = ");
//Serial.print (sensorValue1);
Serial.print (" ");
Serial.println(temperatura1);
// wait 1 seconds before the next loop
delay(1000);
}
Esta solo para 2 sondas, pero solo me lee la primera, en la columna donde debe aparecer la tempertura de la segunda sonda parece copiar el dato de la primera (mismo valor)
Desde ya gracias por las respuestas