Timer with RTC for turn on "LED"



hello, I need help.
I want to put an option in blynk to:
1- select the timezone.
2- Select an on-off time;
When you give the time, (00:00 ~ 00:02), turn on an LED during this time. I need help on how to do it, could you help me in that way?


Timer with RTC for turn on “LED”

Is this a trick question? :wink:

Ah, the Time Input Widget and the RTC Widget?


This is my idea.


Looks like you’re all set.


but I do not know how to take these parameters to the programming, which library, what to include to confirm the timezone, how to put in the IDE the time parameters and send the command according to the time chosen in blynk. If I try to do and show the code, can you tell me the errors or help me?


Absolutely! Look at the sample sketches with the links I included (above).

Please try to (at least) get to the point that your code compiles.

Make sure to include your code like this (```) or the Blynk CFPD (Code Format Police Department) will ticket you …


Download latest Blynk library here:
Blynk is a platform with iOS and Android apps to control
Arduino, Raspberry Pi and the likes over the Internet.
You can easily build graphic interfaces for all your
projects by simply dragging and dropping widgets.
Downloads, docs, tutorials:
Sketch generator: 
Blynk community:  
Follow us:        
Blynk library is licensed under MIT license
This example code is in public domain.
Blynk can provide your device with time data, like an RTC.
Please note that the accuracy of this method is up to several seconds.
App project setup:
RTC widget (no pin required)
Value Display widget on V1
Value Display widget on V2
For this example you'll need Time keeping library:
This code is based on an example from the Time library:
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.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[] = "YourAuthToken";
BlynkTimer timer;
WidgetRTC rtc;
// Digital clock display of the time
void clockDisplay()
  // 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(" ");
  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
  // Synchronize time on connection
void setup()
  // Debug console
  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more:
  setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)
  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);
void loop()

This code is the example of RTC that has contained in blynk, it does not compile. Gives the error ‘stray’ \ 240 ’


The stray ’\ 240’ error message is caused by copying and pasting code in a way which replaces straight quotation marks with curly quotation marks that mark the opening and closing of quoted text.

The code posted above does compile correctly - I’ve just copied it and compiled it in my Arduino IDE.

If the code hadn’t been preceded by triple backticks then the wrong type of quotes would have been substituted.

If you copy code directly from the Blynk sketch builder into the Arduino IDE then you shouldn’t have any problems.



Pete, correct.
I solve this problem now. Thx.
I will continue updating my progress here.


Nothing else :frowning: I’m use arduino 1.6.9; example code RTC does not compile, TIMER does not connect :(( help please


The code you posted above DOES compile, I told you that already.
If you’re getting compiler mesages then you should explain what those messages are.
I have no idea what you mean by “TIMER does not connect”. Can you elaborate please?