Hello,
I’m in the process of creating a “Notification light” for my forthcoming trip to Norway. The plan involves using IFTTT watching the twitter channel @AuroraAlerts and a Particle Photon to flash the “Aurora” (Northern Lights) Colours when the KP index is =<4.
I have the code fully working using a single Breadboard-friendly NeoPixel however when upgrading this to a NeoPixel Ring (16 LED) the code does not run as expected
The current working code for a single NeoPixel can be found here: http://pastebin.com/eMSi3isd
It was my assumption that i would change Line 45 from one LED to Sixteen e.g.:
FastLED.addLeds<NEOPIXEL, 6>(&led, 1); // attach our one NeoPixel LED to pin 6
to
FastLED.addLeds<NEOPIXEL, 6>(&led, 16); // attach our one NeoPixel LED to pin 6
However when i run this code rather than all NeoPixels starting in a “off” state about 7 leds are alight (e.g. http://imgur.com/a/WOY1I) and when the IFTTT trigger is made only the top LED cycles through the colours.
Could someone please advise what i missing?
Thanks
@4dogsofwar, this may have nothing to do with your code but a voltage driving issue with the ring. Which neopixel ring are you using and how is it connected? How are you powering everything?
Also, twittermessage() will never return with both a 30min delay and will loop forever! This is not good given that it is a Particle.function() and needs to return a value quickly.
digitalWrite(pinled, HIGH); // Turn on On-board LED as "pre-notification"
delay(1800000); //Wait 30 mins (1800000 Milliseconds) as @auroraalerts predicts ~50 mins before events )
digitalWrite(pinled, LOW); // Turn off On-board LED
//Turn on Neopixel
while(1){
static int index = 0;
if (++index >= paletteSize) index = 0;
led = ColorFromPalette(auroraPalette, index, 255, LINEARBLEND); //Changed BLEND to LINEARBLEND
FastLED.show();
FastLED.delay(1000 / frameRate);
}
You will need to reconsider your code for the Particle.function() to set a flag and do the work in loop() so as to be non-blocking. You also need to replace the delay(1800000)
with a non-blocking millis() delay and remove the while(1) so that loop() can, well, loop!
Hi @peekay123
Thankyou for your quick response i am currently running the Ring off the 3.3V pin.
Can i assume that it needs 5Vs?
Thanks
Power should not be an issue looking at this thread: Easiest way to wire the Photon to Neopixels
@4dogsofwar, yes, it should be powered from Vin and not the 3.3v pin. However, the code issues still remain.
Thank you i will look into adjusting the code as you are aware i'm fairly new to this!