#include <ILI9488.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <RTClib.h>
#include <EEPROM.h>
RTC_DS3231 rtc; // SDA a pin A4 y SCL a pin A5
#include <FreeDefaultFonts.h>
#define pulsador 3
#define valvula_1 12
#define BLACK ILI9488_BLACK
#define RED ILI9488_RED
#define GREEN ILI9488_GREEN
#define WHITE ILI9488_WHITE
#define TFT_CS 8
#define TFT_DC 9
#define TFT_RST 10
#define SD_CS 4
ILI9488 tft = ILI9488(TFT_CS, TFT_DC, TFT_RST);
void setup() {
//Initialize EEPROM for the first time
if (EEPROM.read(EEPROM_hora_Inicio) != 255 || EEPROM.read(EEPROM_lunes) != 255)
readEEPROM();
else
writeEEPROM();
// Initialize RTC
if(!rtc.begin()){
Serial.println("¡Modulo RTC no encontrado!");
for(;;); //bucle
}
// Set up RTC only if time is not initialized
if (rtc.lostPower()) {
Serial.println("Setting up RTC with the compilation time...");
setRTCTimeFromCompileTime();
}
// Initialize TFT
tft.begin();
tft.setRotation(1);
tft.fillScreen(WHITE);
tft.setTextColor(BLACK,WHITE);
}
.
.
.