#include "ModestIoT.h"
#include "WiFiManager.h"
#include "TimeManager.h"
#include "HeartBioSenseDevice.h"
const char* ssid = "Wokwi-GUEST";
const char* password = "";
const char* url = "https://testingiot.free.beeceptor.com/api/v1/testing"; // Endpoint that represents the Health-Gateway Module
unsigned long lastDataSend = 0;
const unsigned long SEND_DATA_INTERVAL = 5000;
WiFiManager wifiManager(ssid, password, url);
TimeManager timeManager("pool.ntp.org", -5 * 3600, 0);
HeartBioSenseDevice device(&wifiManager, timeManager);
/*
@author: Salvador Salinas
@date: 22/07/2025
@brief: Main project file that initializes the device, time manager & wifi manager
*/
void setup() {
Serial.begin(115200);
Serial.println("Empresa: BioSense Prime S.A");
Serial.println("Developer de FIRSTstudent: Salvador Antonio Salinas Torres");
wifiManager.begin();
timeManager.begin();
}
/*
@brief: Management of wifi connection and time retrieval. The device updates the other components and sends data to endpoint
*/
void loop() {
timeManager.handle();
wifiManager.handle();
device.update();
unsigned long currentTime = millis();
// Send data every 5 seconds to console & endpoint of the Health-Gateway Module
if (currentTime - lastDataSend >= SEND_DATA_INTERVAL) {
lastDataSend = currentTime;
device.sendData();
}
delay(100);
}