#include "DHT.h"
#define pinDHT 4
#define DHTTYPE DHT22
DHT dht(pinDHT, DHTTYPE);
/*
const int p0 = 34;
int valor = 0;
*/
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_MPU6050 mpu;
#include "DataLogger.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
/*// pinMode(p0, INPUT);
while (!mpu.begin()) {
Serial.println("MPU6050 not connected!");
delay(1000);
}
Serial.println("MPU6050 ready!");
*/
Serial.println("Hello, ESP32!");
Myrtc.RTC_init();
MSD.MicroSD_init();
ACT.init_LCD();
//ACT.show_LCD();
//SEN.sensors_init();
dht.begin();
}
//sensors_event_t event;
void loop() {
// sensors_event_t acc, gcc, temp;
// put your main code here, to run repeatedly:
/*Myrtc.get_time();
Myrtc.show_time();
MSD.SaveFile();
MSD.ReadFile();
*/
//Json.FAC_Json();
//Serial.println(Json.FAC_Json("Hola", "Test"));
//Myrtc.get_time();
MSD.SaveFile(Json.FAC_Json(Myrtc.format_time(), Myrtc.format_date()));
MSD.ReadFile();
Tasks.actualizar_tareas();
//Tasks.tarea_MSD();
Tasks.tarea_LCD();
//delay(4000); // this speeds up the simulation
Tasks.tarea_SENS();
/*delay(2000);
float humedad = dht.readHumidity();
float temperatura = dht.readTemperature();
if((isnan(humedad))||(isnan(temperatura)))
{
Serial.println("error al leer datos");
return;
}
Serial.print("Humedad ");
Serial.print(humedad);
Serial.print("%");
Serial.print("Temperatura");
Serial.print(temperatura);
Serial.println("°C");
*/
/*
valor = analogRead(p0);
Serial.println(valor);
// delay(200);
Serial.print("LDR:");
Serial.println(analogRead(p0));
delay(1000);
*/
///////////////////EXITO
/*mpu.getAccelerometerSensor()->getEvent(&event);
Serial.println("Rotation of x axes: ");
Serial.println((gcc.gyro.x)*180/3.14);
delay(500);
*/
}