BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Problem using timer widget with Blynk local server

#1

Hello everybody,

I am using an arduino MKR 1010 to turn a LED on and off based on a timer using Blynk local server. As you can see in the code below first I sync the time and then turn the a digitale output low or high depending on the time.

#define BLYNK_PRINT Serial
#include <SPI.h>;
#include <WiFiNINA.h>;
#include <BlynkSimpleWiFiNINA.h>;
#include <TimeLib.h>;
#include <WidgetRTC.h>;

char auth[] = "xxxx";
char ssid[] = "xxxx";
char pass[] = "xxxx";
WidgetRTC rtc;

BLYNK_CONNECTED() {
rtc.begin();
}

BLYNK_WRITE(V5)
{
Serial.print("Got a value: ");
Serial.println(param.asStr());
if (String(param.asStr())=="1.0")
  { digitalWrite(6,HIGH);
  }
else
 { digitalWrite(6,LOW);
 }
}

void setup()
{
Serial.begin(9600);
pinMode(6,OUTPUT);
Blynk.begin(auth, ssid, pass, IPAddress(192,168,0,101), 8080);
}

void loop()
{
  Blynk.run();
}

If I use the same code on the Blynk cloud server it works. For the local server I only add:

BLYNK_CONNECTED() {
rtc.begin();
}

to update the local time. Why does this code work on the Blynk cloud server and not on the local server?

Thanks in advance,
Bart

0 Likes