Day and night simulation timer

hello all im new to blynk

im searching for a timer to simulate day and night in cycle of 30min

timer 30 to 0 (start night) turns pin8 HIGH (all streetlights will turn on and traffic lights flash yellow)
timer 0 to 30 (start day) turns pin 8 LOW (all streetlights will turn off and traffic lights works normal)
in a loop 0-30 -> 30-0 -> 0-30 ect ect

can someone help me ?

Hello and Welcome to the Blynk Forum.

There are many resources here to help you learn how Blynk works, so that you can learn to control anything you want.

At the Upper Right of this page there are links to the Documents, Help Center and Sketch Builder, where you can learn the commands and see many example sketches that will help you get started.

I would suggest learning how BlynkTimer works and simply setting up a range of coded timers to cycle through your needed pin operations.

You can also setup Eventor schedules and Timer widgets, etc. many ways of doing the same thing.

You can also search this forum for keywords that might bring up other topics full of questions, ideas and even some code, suitable for using timers and RTC.

1 Like

thanks but im totally new to this :slight_smile:

im trying to learn it but its not going great yet :frowning:

i hoped someone could help me with an example or something

Search this forum for “relay pulse” and “servo sweep” for examples of using timers within timer loops

And also check out the main timer documentation that BlynkTimer is based on:

And did you look at the example in the link I already provided for BlynkTimer?

I’m guessing modelrailroad? :wink:

The BlynkTimer is exactly what you need. You can check the PushData example to see how it works.

Here is a simple timer example I provided for another user… Take something like this and build it up into whatever timed sequences you need.

Basic timer snippet for an Action - Delay - Action function.

BLYNK_WRITE(Vx) {  // Virtual button on Vx to activate action
  int BTN = param.asInt();
  if (BTN == 1) {
  digitalWrite(pin, HIGH);  // Set pin high
  timer.setTimeout(5000L, ActionOFF);  // Run ActionOFF function in 5 seconds

void ActionOFF() {
  digitalWrite(pin, LOW);  // Set pin Low

yeah something like that :slight_smile: own lego city :slight_smile:

Omg omg omg show us!!!

I got some modular buildings and I still want to make some lights in them, especially the cinema.

One thing to remember when you use the timer is that when you define a period, you add the L behind the time, that will define it as long because otherwise your timer will do weird stuff :slight_smile:

1 Like

haha just starting building up again just brought a new home so everythings is in parts

Thats the fun part. Blynk and lego fits wel. I think there are a couple of video’s on my youtube channel of a house with the lights.


Stuff here: :slight_smile: