Can send but cannot receive MKR 1010

Not sure what I'm doing wrong. I have two boolean variables both are read/write and have tried both "on change" and periodic with the read designated one.

I am just trying to get comfortable with the cloud iot integration and I have managed to be able to switch blinking on and off with a simple if statement dependent on the bool that I am setting on the dashboard. That works great and reacts immediately. I cannot for the life of me get the dashboard to show the other bool value changing. I can see it changing locally on the board via printing the status on the serial monitor but it doesn't change on the dashboard.

Here's what I have in the void loop. I haven't put anything in the other variable loops but I tried messing with it a little to no avail.

if (commandBlink == true) {
    digitalWrite(led, HIGH);
    blink = true;
    delay(500);
    digitalWrite(led, LOW);
    blink = false;
    delay(500);
  }
    else
    {
      digitalWrite(led, LOW);
      blink = false;
  }

Any ideas?

Anyone? This has gotta be something simple.

Hi @bsinor
delay() call is blocking execution so data wont be updated cloud side because the resulting value of blink variable before ArduinoCloud.update() call is always false.

You have to implement your blink without blocking the loop

Excellent answer my friend.

It's now working as intended.

Thank you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.