BUENAS NOCHES, OMAR ALVAREZ DE VENEZUELA, ESTOY TRA TANDO DE COMUNICAR UNA PANTALLA TFT ST7735 MAS UN TERMOPAR MAX 6675 Y UN ESP32, CUANDO CORRO LA APLICAION SE CONGELA LA LECTURA DE LA TEMPERATURA CREO QUE HAY UNCONFLICTO CON EL USO DEL GPIO23 EL CUAL LO USAN AMBOS DISPOSITIVOS, NECESITO AYUDA
SALUDOS
Omar Alvarez
#include "BluetoothSerial.h"
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_ST7735.h> // Hardware-specific library for ST7735
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <Wire.h>
#include <max6675.h>
#include <ESP32Time.h>
#include <SPI.h>
#define TFT_CS 4
#define TFT_RST 15 // you can also connect this to the Arduino reset
#define TFT_DC 25
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run make menuconfig to and enable it
#endif
int thermoDO = 19;
int thermoCS = 23;
int thermoCLK = 5;
const float portPin =34;
float potValor = 0;
float voltaje=0;
int Bandera=1;
char hora;
char men;
float tempAgua;
int PinBuzzer=13;
int retardo=0;
int led1 = 26;
int led2 = 27;
int menum;
MAX6675 thermocouple(thermoCLK, thermoCS, thermoDO);
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
ESP32Time rtc;
BluetoothSerial SerialBT;
void setup(){
Wire.begin();
Serial.println("MAX6675 test");
rtc.setTime(15, 10, 3, 22, 5, 2022);
pinMode(PinBuzzer,OUTPUT);
Serial.begin(115200);
SerialBT.begin("Quarks'Lab"); //Bluetooth device name
Serial.println("Dispositivo Iniciado, ¡ahora puedes conectar tu SmartPhone!");
Serial.println(thermocouple.readCelsius());
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
tft.initR(INITR_BLACKTAB);
tft.setRotation(1); // 0 - Portrait, 1 - Lanscape
tft.fillScreen(ST7735_BLUE);
tft.setTextSize(2); // Seta o tamanho da fonte de texto para o tamanho 2
tft.setTextColor(ST77XX_YELLOW);
tft.print(" QUARKS'LAB");
tft.setCursor(4, 20);
tft.setTextColor(ST7735_WHITE);
tft.setTextSize(1,2);
tft.print("TEMPERATURA :");
tft.setCursor(100, 20);
tft.setTextColor(ST7735_WHITE);
tft.print(thermocouple.readCelsius());
tft.setCursor(4, 36);
tft.print("ALTERNADOR : 13 V");
tft.setCursor(4, 52); //
tft.print("ELECTRO VENT. : ACTIVO");
tft.setCursor(4, 68); //
tft.print("GASOLINA Lts. : 30 Lts.");
tft.setCursor(4, 84); //
tft.print("Km/Lts GASO. : 390 Kms.");
Serial.println("INICILIZADO TFT...");
uint16_t time = millis();
time = millis() - time;
Serial.println(time, DEC);
}
void loop(){
if (SerialBT.available()) {
Serial.println("entreo a serial BT");
men = SerialBT.read();
}
if (men == 'A'){
digitalWrite(led1, HIGH);
Serial.println("Rele 1 activado");
}
else if (men == 'B'){
digitalWrite(led1, LOW);
Serial.println("Rele 1 desactivado");
}
if (men == 'C'){
digitalWrite(led2, HIGH);
Serial.println("Rele 2 activado");
}
else if (men == 'D'){
digitalWrite(led2, LOW);
Serial.println("Rele 2 desactivado");
}
int hora = rtc.getHour();
String horaF=rtc.getTime();
potValor = analogRead(portPin);
voltaje=map(potValor,0,6001,0,25);
tft.setCursor(100, 20);
//tft.setTextColor(ST7735_RED);
tft.setTextColor(ST7735_RED, ST7735_BLUE);
tempAgua=thermocouple.readCelsius();
tft.print(tempAgua);
Serial.println(thermocouple.readCelsius());
}
void alerta(){
digitalWrite(PinBuzzer, HIGH);
