I want to show an indicator led for the connection of my Electron to the cloud. for this reason I wrote following code:
void loop(){
// check if connected to cloud
if (Particle.connected()){
Status = 0; // Status OK
}else{
Status = 1; // Status Error
}
switch(Status){
case 0:
digitalWrite(D0, HIGH);
break;
case 1:
digitalWrite(D0, HIGH);
delay(500);
digitalWrite(D0, LOW);
delay(500);
break;
}
So theoretically the LED on D0 should blink until connected.
Instead it is dark during the status LED is flashing green and it goes on when the connection is established so the status LED is slowly blinking cyan.
Does this mean that the loop is not entered until the connection is established?
Any ideas?