Two solenoids for a metronome device

Hello fellow Blynkers

I’m working on a project with two small solenoids that is packed in a wodden box and hitting the sides, making a metronome like sound.

I want to have two sliders and an on/off button in my control panel on my phone. I want one of the sliders to control the delay between the triggers(100-1000 ms) , and the other slider to control the HIGH of them (1-5 ms)
I want the solenoids to shift between them, so it’s going to go like this:

  • Solenoid 1 HIGH for X ms
  • Solenoid 1 LOW for Y ms
  • Solenoid 2 HIGH for X ms
  • Solenoid 2 LOW for Y ms

I’ve managed to do so in a similar project using delay, but I’ve figured out that’s a nogo with Blynk, so I’ve tried out this strobe example using SimpleTimer, but the problem is that it’s only one slider, and the on/off time is the same.

Any advice and solutions would be greatly appricated! Also note right now I’m just using LEDs for testing purposes, since i dont want to burn solenoids

Heres my code so far:

#include <ESP8266WiFi.h>
#include <SimpleTimer.h>
#include <BlynkSimpleEsp8266.h>

SimpleTimer timer;
SimpleTimer timerSlag;

char auth[] = "****";

#define LED_PIN D1
int t1;

void setup()
  Blynk.begin(auth, "XXXX", "XXXX");
  Serial.println("setup done! Script is running...");

  if (param[0].asInt()) {
  } else {
    digitalWrite(LED_PIN, LOW);
//  Toggle LED
void ledBlynk()
  digitalWrite(LED_PIN, !digitalRead(LED_PIN));
// Change blink interval using virtual pin 2
  int interval = param[0].asInt();
  boolean wasEnabled = timer.isEnabled(t1);
  t1 = timer.setInterval(interval, ledBlynk);
  if (!wasEnabled) {

void loop()

Thanks in advance!

Try using timer.timeOut() or timer.setTimer() timers… I did something similar for adjustable timing here. You will have to extrapolate the logic needed for your purposes.