So here's the standard opening line, I amnpretty new to arduino and coding and such, but I am slowly learning.
I have a halloween project that has two separate neopixels (one for eyes and one for a lantern) and I want to run two different patterns on them. One will be a fade effect for the eyes and the other a flame effect for the lantern. I would like these to be triggered by a P.I.R. or microwave sensor (what I have on hand) for when people get near it. Then I want the eyes to turn on first with about a 3-5 second delay before turning on the lantern. I would like both to stay in for about 30 seconds and then reset for the next person.
So as a re-cap:
PIR sense motion
Eyes turn on (fade effect)
3-5 seconds later, Lantern turns on (flame effect)
Both stay on for 30 seconds
Both turn off at the same time
Reset for next motion/movement
Questions:
Can I do all of this with one arduino?
Can code be written for separate neopixel patterns running at the same time on one arduino?
2a. Where can I find that code or something similar?
Should I use a couple of Nanos instead?
3a. How would that work?
Is there a better method that I am not thinking about or aware of?
I'm not looking for this to be done for me, just point me in the right direction...and maybe answer some questions I may have down the line. Oh, and I'm in no hurry. I know it's Oct 11th already, but if this has to wait until next Halloween it's no big deal for me.
Neopixels can be daisy-chained. So you only need one wire on the Nano to control all the lights.
Which library are you using? fastLED? You can make it do different things on individual LEDs or on blocks of them. Just set it up so the eyes are one block and then you can apply the eye effect to that number of LEDs.
Most of the examples you will see for fastLED animations will use for() loops and delay()s. This is bad programming practise. It's useful to just test that all your LEDs work but it's not useful for real animations where you want more than one thing to happen simultaneously.
Keep looking online for examples which use a "state machine" approach instead of delay(). Maybe something with "frames" or "arrays" to store the steps in each animation.
Thank you for your speedy reply! I havn't decided which library to use. I've heard pros and cons about FastLed. I am somewhat familiar with the adafruit Neopixel library. I know you can daisy chain them, but I wasnt sure that I could run a fade program on the first 14 and then a flame program on the last seven (I have neopixel jewels, 7 lights per disc). That seems like it would be harder to do. I have read that the for()loops and delays() wouldn't work very good in this particular application, but the alternative is waaaaay beyond my comprehension. I've read a little about arrays and frames but nothing about state machines. I will look into it. Any particular articles or guides that you like specifically?
No, sorry. I don't have any good links to tutorials on LED animations.
Stay away from Instructables. They are always poor quality. Sometimes you will see a good idea there, but it's always better to go somewhere else to get good advice on how to build that idea.