Stuck solid white? or Solid magenta/yellow?

Hello there!

I have this sparkfun photon redboard and it was working fine a few hours ago, however it started acting up just now. The main problem is I don’t know what color it is. When I run my code from particle it starts off fine like usual however after it blinks cyan it turns into this solid color that’s sort of white, but it’s more like half magenta and half yellow. I can’t tell if it’s supposed to be white because it’s very bright and it hurts my eyes to look at it. I’m pretty sure it’s not that the wifi is off because I didn’t do anything that would turn the wifi off, and I tried other wifi networks as well as other code.

Description of rgb light:
Its half magenta and half yellow but if you just look at it with both eyes with nothing in its way its a very bright white. You can tell its magenta and yellow because it gives off rays of magenta and yellow.

Thanks for helping!
Sylverost

You can always upload a video of the bootup.
If you turn down exposure or put a piece of white paper over the LED it might also be easier to see.

But any steady RGB LED color (unless controled via RGB.color() by yourself) is indicating some kind of deadlock in your code.
So posting your code might also be required.

Additionally you can also try SYSTEM_THREAD(ENABLED).

Heres the video:
video
As to the code, even a blank sheet of code with

void setup(){

}
void loop(){

}

doesn’t flash, so I’m led to believe that it’s some sort of wifi connection problem. I searched online for color codes and they said that breathing white was telling the user that the photon’s wifi module was off, but I don’t understand how I could’ve turned it off. I also tried changing the wifi network but that gave me the same result.

Try particle update and particle flash --usb tinker both in DFU Mode.

1 Like

I tried both while in DFU mode, they didn’t work

The you better get dfu-util, this does help in multiple cases.

Thanks so much!! It worked!

However, when I run specifically this line of code, it turns back to the white/yellow color. Do you have any idea why?

int pins[] = {A0, A1, A2, A3, A4, A5, D7, D6, D5, D4};
boolean isLeft = true;
boolean canChange = true;
int i;

void checkButton(){
    if (digitalRead(D2) == HIGH && canChange) {
        isLeft = !isLeft;
        canChange = false;
    }
    if (digitalRead(D2) == LOW) {
        canChange = true;
    }
}

void setup() {
    for (i = 0; i < sizeof(pins); i++) {
        pinMode(i, OUTPUT);
    }
    
    pinMode(D2, INPUT_PULLUP);

}

void loop() {
    
    checkButton();
    
    if (isLeft) {
        for (i = 0; i < sizeof(pins); i++) {
            if (i <= -1) i = 0;
            digitalWrite(pins[i], HIGH);
            checkButton();
            delay(300);
            checkButton();
            if (!isLeft) break;
            digitalWrite(pins[i], LOW);
        }
    }
    
    if (!isLeft) {
        for (; i > -1; i--) {
            if (i >= sizeof(pins)) i = sizeof(pins) - 1;
            digitalWrite(pins[i], HIGH);
            checkButton();
            delay(300);
            checkButton();
            if (isLeft) break;
            digitalWrite(pins[i], LOW);
        }
    }
 }

This loop does not iterate 10 times but 40 times since an int has 4byte and sizeof() reports the number of bytes in your array.

The correct calculation for the number of pins would be this

const int pinCount = sizeof(pins) / sizeof(pins[0]);

And then only use pinCount wherever you used sizeof(pins) before.

BTW:
How would following if()s ever be true?

     for (i = 0; i < sizeof(pins); i++) {
       if (i <= -1) i = 0;
       ... // no mamipulation to i here
     }
     ... // no manipulation to i here either
     for (; i > -1; i--) {
        if (i >= sizeof(pins)) i = sizeof(pins) - 1;
        ... // the same
      } 
1 Like