Breathing Green

I’m having a strange problem of my Photon flashing green after about 10 seconds of breathing green just after pushing fresh code via the web IDE. It seems random as sometimes after I put the Photon in safe mode it flashes and runs just fine. Then my next flash without it being in safe mode pushes and updates fine but then goes green after 10 seconds. Sometimes reseting it a couple times manual keeps it breathing cyan. I’ve read that it means its loosing connection to the particle cloud but I don’t have anything in my loop code but Blynk. I’m just getting started with working with some neopixels and controlling a femtobuck to power some 1w LED’s so it is at the very beginning stages. I figured I would post my code now before I complicate it even more.

Basically at this point I am able to control the femtobuck with a blynk button on Pin V55. It works just fine as long as it keeps breathing cyan. Am I missing anything I should be aware of? Thanks for any help!

#include "application.h"

// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"
char auth[] = "123456abcd";

// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"
    
#define PIXEL_COUNT 1
#define PIXEL_PIN D0
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

boolean light_status = false;

void setup() {

    pinMode(A4, OUTPUT);   // sets the pin as output

    strip.begin();
    strip.show(); // Initialize all pixels to 'off'
    
    Blynk.begin(auth);

}

void loop() {

    Blynk.run();

}

BLYNK_WRITE(V55){
    
  if(light_status){
        
        analogWrite(A4, 0);
        light_status = false;

    } else {
        analogWrite(A4, 255);
        light_status = true;
    }

}

Could you try using system threading? That might help against blocking code.

1 Like

That seems to have fixed it. I’ll keep building and if I don’t have any more issues in the next couple days i’ll mark as solved. Thanks for your help!

2 Likes

Several other people have had this problem. It appears that it has to do with Blynk.begin. This function blocks, and if it takes too long (~10 seconds), then your device will drop the connection to the cloud (unless you’re using system threading).

2 Likes