Hi there folks,
Been having a little problem with my neopixel code unfortunately. I have flashed it successfully several times and have determined that it’s not the photon (other code works perfectly well on it). Forgive me for my noobishness.
I have a photon plugged into a shield shield for 3.3v -> 5v Logic shifting and a single neopixel hooked into the shield on pin 7, 5v and gnd (just like an arduino) and have tried changing the pin used for data. I can’t get it to react to any of the code I have loaded.
Now, I’m pretty experienced with the arduino neopixel library and I generally know all the correct use of functions, but I’m still sort of new to the particle firmware coming over from arduino, so I stuck with simple and tried to turn my single neopixel red.
Here is my code:
// This #include statement was automatically added by the Particle IDE.
#include "neopixel/neopixel.h"
//Strip Defenition
Adafruit_NeoPixel strip = Adafruit_NeoPixel(1, 7, WS2812);
//Colors
uint32_t red = strip.Color(255, 0, 0);
uint32_t orange = strip.Color(255, 128, 0);
uint32_t yellow = strip.Color(255, 255, 0);
uint32_t green = strip.Color(0, 255, 0);
uint32_t light_blue = strip.Color(0, 255, 255);
uint32_t blue = strip.Color(0, 0, 255);
uint32_t purple = strip.Color(127, 0, 255);
void setup() {
strip.begin();
strip.setBrightness(255);
strip.show();
}
void loop() {
strip.setPixelColor(1, red);
strip.show();
delay(1000);
/* commented out for a single color
strip.setPixelColor(1, orange);
strip.show();
delay(1000);
strip.setPixelColor(1, yellow);
strip.show();
delay(1000);
strip.setPixelColor(1, green);
strip.show();
delay(1000);
strip.setPixelColor(1, light_blue);
strip.show();
delay(1000);
strip.setPixelColor(1, blue);
strip.show();
delay(1000);
strip.setPixelColor(1, purple);
strip.show();
delay(1000);
*/
}
The library included is the latest available from here https://github.com/technobly/SparkCore-NeoPixel