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 …

image

/*********************
Download latest Blynk library here:
https://github.com/blynkkk/blynk-library/releases/latest
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: http://www.blynk.cc
Sketch generator:           http://examples.blynk.cc
Blynk community:            http://community.blynk.cc
Follow us:                  http://www.fb.com/blynkapp
http://twitter.com/blynk_app
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
WARNING :
For this example you'll need Time keeping library:
https://github.com/PaulStoffregen/Time
This code is based on an example from the Time library:
https://github.com/PaulStoffregen/Time/blob/master/examples/TimeSerial/TimeSerial.ino
*********************/
/* 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(currentTime);
  Serial.print(" ");
  Serial.print(currentDate);
  Serial.println();
  // Send time to the App
  Blynk.virtualWrite(V1, currentTime);
  // Send date to the App
  Blynk.virtualWrite(V2, currentDate);
}
BLYNK_CONNECTED() {
  // Synchronize time on connection
  rtc.begin();
}
void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth);
  // Other Time library functions can be used, like:
  //   timeStatus(), setSyncInterval(interval)...
  // Read more: http://www.pjrc.com/teensy/td_libs_Time.html
  setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)
  // Display digital clock every 10 seconds
  timer.setInterval(10000L, clockDisplay);
}
void loop()
{
  Blynk.run();
  timer.run();
}

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.

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?

Pete.