/*
medicion de temperaturas para ILI9341 LCD
:https//wokwi.com/arduino/projects/308024602434470466
*/
#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
#include <DallasTemperature.h> //library for DS18B20 sensors
#define TFT_OLIVE 0x7BE0 /* 128, 128, 0 */
#define TFT_BLUE 0x00FF /* 0 , 0, 255 */
#define TFT_RED 0xF800 /* 255 , 0 , 0 */
#define TFT_GREEN 0x07E0
#define TFT_YELLOW 0xFFE0
#define TFT_WHITE 0xFFFF
#define TFT_BLACK 0x0000
#define TFT_DC 48
#define TFT_CS 53
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
OneWire oneWire1(26); //temperatura de salida
DallasTemperature sensors1(&oneWire1);
OneWire oneWire2(24); //temperatura de entrada
DallasTemperature sensors2(&oneWire2);
OneWire oneWire3(22); //temperatura del cuerpo
DallasTemperature sensors3(&oneWire3);
void setup() {
tft.begin();
tft.setRotation(0);
tft.setCursor(5, 5);
tft.setTextColor(TFT_BLUE);
tft.setTextSize(3);
tft.print(" MEDICION " );
tft.setTextColor(TFT_WHITE);
tft.setCursor(5, 40);
tft.print("TEMPERATURAS " );
tft.setCursor(5, 80);
tft.print(" CALDERA");
sensors1.begin();
sensors2.begin();
sensors3.begin();
delay(500);
}
void loop() {
// LEER SENSORES
sensors1.requestTemperatures();
sensors2.requestTemperatures();
sensors3.requestTemperatures();
float salida = sensors1.getTempCByIndex(0);
float entrada = sensors2.getTempCByIndex(0);
float cuerpo = sensors3.getTempCByIndex(0);
float caudal = 0;
delay(2000);
tft.fillRect(0, 120, 240, 120, TFT_BLACK);
tft.setCursor(5, 160);
tft.setTextColor(TFT_BLUE);
tft.setTextSize(3);
tft.print("T.ENT:");
tft.setCursor(120, 160);
tft.setTextColor(TFT_RED);
tft.print(entrada,1);tft.print(" C");
tft.setCursor(5, 200);
tft.setTextColor(TFT_BLUE);
tft.setTextSize(3);
tft.print("T.SAL:");
tft.setCursor(120, 200);
tft.setTextColor(TFT_RED);
tft.print(salida,1);tft.print(" C");
tft.setTextColor(TFT_BLUE);
tft.setTextSize(3);
tft.setCursor(5, 240);
tft.print("T.CUE:");
tft.setCursor(120, 240);
tft.setTextColor(TFT_RED);
tft.print(cuerpo,1);tft.print(" C");
tft.setTextColor(TFT_BLUE);
tft.setTextSize(3);
tft.setCursor(5, 280);
tft.print("Q");
tft.setTextSize(2);tft.print("[l/m]");
tft.setTextSize(3);
tft.setCursor(95, 280);
tft.print(":");
tft.setCursor(120, 280);
tft.setTextColor(TFT_RED);
tft.print((cuerpo/3),1);
delay(2500);
}
SALIDA
ENTRADA
CUERPO