Buenas tardes.
Pongo el código ya que cuando puse el anterior post no tenía el código en el ordenador. Está con distintos valores en las temperaturas.
#include <PCD8544.h>
static const byte sensorTc = 0;
static const byte sensorTa = 1;
static const byte ledCal = 11;
static const byte ledBom = 10;
//Tamaño de la pantalla (pixeles)
static const byte LCD_WIDTH = 84; //Ancho
static const byte LCD_HEIGHT = 48; //Alto
static const byte CHART_HEIGHT = 5;
static const byte DEGREES_CHAR = 1;
static const byte degrees_glyph[] = { 0x00, 0x07, 0x05, 0x07, 0x00 };
static PCD8544 lcd;
float getVoltage (int pin) {
return (analogRead(pin) * .004882814);
}
void setup() {
Serial.begin(9600);
lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.createChar(DEGREES_CHAR, degrees_glyph);
pinMode(ledCal, OUTPUT);
pinMode(ledBom, OUTPUT);
}
void loop() {
static byte xChart = LCD_WIDTH;
float tempTa = getVoltage(sensorTa);
tempTa = (tempTa) * 100;
delay(250);
lcd.setCursor(0, 0);
lcd.print("TAcum: ");
lcd.print(tempTa, 1);
lcd.print("\001C ");
delay(250);
float tempTc = getVoltage(sensorTc);
tempTc = (tempTc) * 100;
delay(250);
lcd.setCursor(0, 1);
lcd.print("TCald: ");
lcd.print(tempTc, 1);
lcd.print("\001C ");
if (tempTa < 40) {
digitalWrite(ledCal, HIGH);
lcd.setCursor(0, 3);
lcd.print("Caldera: ON ");
}
if (tempTa > 60) {
digitalWrite(ledCal, LOW);
lcd.setCursor(0, 3);
lcd.print("Caldera: OFF");
}
if (tempTc > tempTa && digitalRead(ledCal) == HIGH){
digitalWrite(ledBom, HIGH);
lcd.setCursor(0, 4);
lcd.print("Bomba: ON ");
}
if (tempTc <= 65 && digitalRead(ledCal) == LOW){
digitalWrite(ledBom, LOW);
lcd.setCursor(0, 4);
lcd.print("Bomba: OFF");
}
}
Muchas gracias.