The closest I’ve been able to get is this code (which actually crashes my Photon)…
/*
* This is a minimal example, see extra-examples.cpp for a version
* with more explantory documentation, example routines, how to
* hook up your pixels and all of the pixel types that are supported.
*
*/
#include "application.h"
#include "neopixel/neopixel.h"
SYSTEM_MODE(AUTOMATIC);
// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN D6
#define PIXEL_COUNT 24
#define PIXEL_TYPE WS2812
Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);
void setup()
{
strip.begin();
strip.show(); // Initialize all pixels to 'off'
}
void loop()
{
rainbow(20);
}
void rainbow(uint8_t wait) {
uint16_t i, j;
for(j=0; j<256; j++) {
for(i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, Wheel((i+j) & 255));
}
strip.show();
delay(wait);
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
if(WheelPos < 85) {
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
} else if(WheelPos < 170) {
WheelPos -= 85;
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
} else {
WheelPos -= 170;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
}
As you can see, the switch case is for the types of neopixel LEDS. You defined PIXEL_TYPE WS2812 in your code, a type that does not exist in the library. Googling around I found out that one of the differences between WS2812 and the WS2812B is timing, the WS2812B uses slightly different timing. Also, the WS2812 has 6 pins where the WS2812B has 4 pins. Looking at the product pictures at adafruit, it looks like you got WS2812B leds on the board, not WS2812 as adafruit says.
So change PIXEL_TYPE WS2812 to PIXEL_TYPE WS2812B and you should be fine!
Edit: I now see the comment at case WS2812B: // WS2812 & WS2812B = 50us reset pulse so it doesn’t even matter if you have WS2812 or WS2812B
According to the docs, factory reset is not available for the Photon. So I tried the following…
Entered DFU mode
particle flash --usb tinker
Flashed a very simple “blink led” script via the web ide
At this point it started blinking magenta for 5 mins, then I got a few flashes of white, etc and then back to blinking magenta for 3 minutes. After that, everything seems fine with the simple script running successfully.
Next, I flashed the original NeoPixel code mentioned above and it works!
My guess is that somehow the neopixel script was interfering with the firmware update process?
Happy to hear it is solved, I was confused with the core haha.
Well, I guess so since flashing a simple project worked.
Perhaps some of your not necessary declarations as #include "application.h" may have caused some trouble. Something else could be the usage of an external library which could have interrupted the FW update. Anyhow, yayy!