Hi I am building a project that turns on an led when the time is 7PM. Fow hardware I have a Wemos D1 Mini. I have edited the RTC code but cant get the led to turn on. I just have the RTC widget and two value widget to display the time and date which are on V16 and V17. I also have an led connected to D2. When I open the serial monitor the time and date are correct. Can someone check my code and tell me what am I doing wrong?
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define led 4
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "5eaf67aaedc94220947d3908bff4b094";
char ssid[] = "Clayton Camilleri Wi-Fi";
char pass[] = "clayton13";
BlynkTimer timer;
WidgetRTC rtc;
// Digital clock display of the time
void clockDisplay()
{
if (hour() > 19)
{
digitalWrite(led, HIGH);
}
else if (hour() < 19);
{
digitalWrite(led, LOW);
}
// You can call hour(), minute(), ... at any time
// Please see Time library examples for details
String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + " " + month() + " " + year();
Serial.print("Current time: ");
Serial.print(currentTime);
Serial.print(" ");
Serial.print(currentDate);
Serial.println();
// Send time to the App
Blynk.virtualWrite(V16, currentTime);
// Send date to the App
Blynk.virtualWrite(V17, currentDate);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// Begin synchronizing time
rtc.begin();
// Other Time library functions can be used, like:
// timeStatus(), setSyncInterval(interval)...
// Read more: http://www.pjrc.com/teensy/td_libs_Time.html
// Display digital clock every 10 seconds
timer.setInterval(1000L, clockDisplay);
}
void loop()
{
Blynk.run();
timer.run();
}