Before creating the topic
• Hardware model : ESP32
• Android 12
• local server
• Blynk Library version 0.6.1 by Volodymyr
My project basically Auto Pet Feeder where user will input time HH:MM and Days.
My issue here as in Blynk Documentation for Time input Widget where the time are stored in seconds. How do I change the receive input in seconds into HH:MM and additionally, can someone help me to compare current days with scheduled days by user. Please note user can insert multiple days (e.g for every day at 9.00A.M, food will dispense out)
BLYNK_WRITE(V1) {
// param[0] is the user time value selected in seconds.
Serial.print("Start time in sec: "); Serial.println(param[0].asInt());
// param[3] is the day of the week where 0=Sun … 6=Sat
Serial.print("Day of week: : "); Serial.println(param[3].asInt());
}
BLYNK_WRITE(V10) {
// param[0] is the user time value selected in seconds.
scheduleTimeM = param[0].asInt();
// param[3] is the day of the week where 0=Sun .. 6=Sat
//scheduleDayM = param[3].asInt();
Serial.print("Got The Time ");
Serial.print(scheduleTimeM);
}
/**************************************************************************/
void checkScheduleM() {
timeClient.update();
HH = timeClient.getHours();
int hours = HH;
if (hours == 0) hours = 12;
if (hours > 12) hours = hours - 12;
Serial.print(hours);
Serial.print(": ");
MM = timeClient.getMinutes();
Serial.println(timeClient.getMinutes());
currentTime = 3600 * hours + 60 * MM;
if (scheduleTimeM == currentTime) {
rotateServo();
}
}