Yun + Digital Light Dimmer

I’m new with electronic and Arduino. Before that i’ve problem and i will try to solve by myself. Now I’ve some problem and hope some body can advise to me.

My stuff

  1. Arduino Yun
  2. 8 CHANNEL DIGITAL LIGHT DIMMER with zero-cross detector Brand : KRIDA Electronics
  3. LED light 1000w
  4. Cannot use timerone.h

I would like to dim my LED light. Now my code can dim with Blynk but just only few minutes. I think i send data a lot to server and its kick from server Blynk. I don’t know why, coz’ i set interval time already. So please advise some hint to me. Thank you

#define BLYNK_PRINT Serial
#include <SPI.h>
#include <Bridge.h>
#include <BlynkSimpleYun.h>
#include <SimpleTimer.h>

#define triacApin 6
int power = 0;

char auth[] = "";

SimpleTimer timer;

void setup()
  pinMode(triacApin, OUTPUT);
  digitalWrite(triacApin, LOW);
  timer.setInterval(1000L, zero_cross_detect);
  attachInterrupt(0, zero_cross_detect, FALLING);

  Serial.print("Power: ");
  power = param.asInt();

void zero_cross_detect()
if(power > 0){
  int dimtime = (75*power); 
  delayMicroseconds(dimtime);    // Wait till firing the TRIAC
  digitalWrite(triacApin, HIGH);   // Fire the TRIAC
  delayMicroseconds(10);         // triac On propogation delay (for 60Hz use 8.33)
  digitalWrite(triacApin, LOW);    // No longer trigger the TRIAC (the next zero crossing will swith it off) TRIAC
  digitalWrite(triacApin, LOW);

void loop()

What happens after this few minutes? Code seems fine for me.

I can dim only one time then its stuck. Blink Server is reconnect. I don’t know why?

What error message do you see?

I don’t know what does it mean “Invalid HW cmd: r”

@vshymanskyy do you know what it could be?

Thank you for helping :wink:

The message means, in general, that you have somehow broken communication between Blynk Cloud and the device.
This may be some glitch, that appears because of high Voltage/Current electromagnetic spikes in you project.

Thank you for answer but have you have any advise for me. I don’t have any idea now. Thank you