Timer in blynk

#define BLYNK_PRINT Serial

#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[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

char ssid[] = "xxxx";
char pass[] = "xxxxxxxxxxxxxx";

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(" ");
  Blynk.virtualWrite(V1, currentTime);
  Blynk.virtualWrite(V2, currentDate);

//void slem()
  //(Blynk.virtualWrite(V5, 0));
  //(Blynk.virtualWrite(V5, 255));
  //(Blynk.virtualWrite(V6, 0));
  //(Blynk.virtualWrite(V6, 255));

void setup()
  Blynk.begin(auth, ssid, pass);
  timer.setInterval(1000L, clockDisplay);

void loop()
  (Blynk.virtualWrite(V5, 0));
  (Blynk.virtualWrite(V5, 255));
  (Blynk.virtualWrite(V6, 0));
  (Blynk.virtualWrite(V6, 255));

lamp on start timer
lamp off stop

Hello… Welcome to the Blynk forum.

First off… as per the directions that you deleted when posting (you did read them first… correct? :wink: )… you must properly format all posted code for proper forum viewing…

Blynk - FTFC

Then do so :stuck_out_tongue: we will point you in the right direction, but you need to do the thinking.

And without much more details we don’t understand why you want a timer that only works this way… since what you are trying to do matters to the type of timer you want to use and how you set it up…



1 Like

@Blynk_Coeur OP edited the comment (made it even less informative :man_facepalming: ) but didn’t format the code… so I don’t even bother to look closely at unformatted code :stuck_out_tongue: But now that you have pointed that out… yep, too scary :scream:

1 Like

@Gunner hmmm, when I start with blynk , I always made the same mistake since you explained me :wink:

Well the OPi hasn’t logged back in since, so I formatted the code… but I think the rest is up to the OP or some gracious user with lots of time :slight_smile: