I have a Small Model Railway, 15 buildings, all with 1 LED, some with 2.
All connected with an Arduino Nano and a TLC5974 24 channel PWM controller. I used PWM so I could set the desired brightness, rather than trying to tweak resistor values.
Extra, higher drain LED chains, such as street lights, are driven via the Arduino I/O pins via a ULN2003 driver board.
These are all working in a demo mode, sequencing from one to the next, with 1024 step PWM ( 4 steps to full bright)
I'm looking for a smarter way to setup a 24-hour lighting sequence (compressed into an hour or two), but not sure as to the most appropriate program flow structure to choose.
Normally, I'd set one LED, use delay(xxxx) and then move to the next , but that's not efficient, and I'd probably run out of program space
For Next loops ?
While Wend ?
Do While ?
I was thinking something like defining the name, then the start time, end time and brightness. - 4095 is full brightness.
DEFINE Farmhouse_interior, 1800,2300,4095
DEFINE Farmhouse_exterior, 1900,2100,2048
Would this need the use of a timer or interrupt ?
Or something totally different?
I'm pretty much at the absolute beginner stage of C programming, other than tweaking existing Arduino sketches, that's about it ..
Looking for some pointers(?) to overcome the initial hurdle.