I have a model building with several windows and want the various LEDs I have put inside to randomly switch on and off with minutes/hours between them.
Hardware on my nano is sorted, but I'm struggling with the code.
Any help would be really appreciated, I'm sat here with my model in darkness, waiting for life!!
Your code would be heavily dependent on how you have your LEDs hooked up to the arduino. Does it go through an I2C, a Serial bus, Each LED driven or controlled by a separate Pin. Lots of factors that can't be guessed. Do you have a schematic handy? Please don't take this as a discouraging post, but the examples menu has a lot of good material to look over like Blink without delay. This would allow you to turn on and off your LEDs without having the microcontroller sleep causing it to miss careful time events.
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Show us what you have in code and we can advise you on getting it to perform the way you want.
Tom, that video is great!!! Did some digging and found the code in model railway hobbyist. The problem was the code was published in the magazine wrong, after more digging I have managed to find the correct code written in the comments section by the great man Geoff Bunza himself:
Everything works great! Was like magic when I hit upload to my nano. : )
So, just one last question if I may, the code I've used above I would like just one of the LED's (pwm pin 11) to fade. I've looked at the fade sketch and tried working it in but I'm struggling to work out how to bolt that on.
Can these two things be even combined? I'm struggling, am I beating up the wrong bush? Just want one of my leds (pin 11) to do something different to the rest...