Arduino Nano sketches for LED animation help

LimeyBuilds

Well-Known Member
Working on a prop and looking into lighting for it. I have found the hardware and software for the Arduino Nano, and understand the animations are programmed using 'sketches' I cannot seem to find any info anywhere on how to write these sketches and what commands can be used for what purposes. Just to give an Idea, if possible, this is the animation I am going for: (hopefully it makes sense)

Lights1.jpg
Lights2.jpg
Lights3.jpg
Lights4.jpg
Lights5.jpg
 
So you want the lights to turn of in sequence every time you press the momentary contact switch?
Correct, yes. Main switch powers 4 lights ON. Momentary turns the 4 off in sequence with 1 second interval between. No interval before the first one goes out. All lights remain off until circuit is restarted with main switch.
 
I have put together a quick pass at the code, but I need to test it. I'm still learning, so I want to test it to be sure I'm not giving you messed up code
 
I have put together a quick pass at the code, but I need to test it. I'm still learning, so I want to test it to be sure I'm not giving you messed up code
Oh, wow. I don't know what to say. I was just trying to find a guide to the code language and such, but thank you for the effort
 
Here is a rough schematic. You probably need series resistors for the LEDs, I left them out for ease of drawing. The zip folder is the tested code. It's set up for a Arduino Nano, but it can be adjusted for an Uno as well.

Schemtic.jpg
 

Attachments

  • LimeyBuilds_Sketch.zip
    189 KB · Views: 88
There are Example programs in the Arduino Compiler, and there website is pretty helpful Arduino Reference - Arduino Reference . They also have a forum on there site where you can ask questions, It's one of the easiest languages to learn.
I managed to get the nano every and test this today. I am just wondering if the program requires pressing momentary switch each time to turn out an LED? If i press once, the first LED goes out, but i have to press for each LED. If the program is designed that way, I will have to see what I need to change. I can see a button count at 5. I am hoping that a single press of the momentary switch will initiate the full switch off animation. Everything else works perfectly with the off switch. very exciting!
 
My friend!! I think I somehow did it. I tried altering something, that didn't work, so I altered a couple other things and here i think this is it!!!! You are awesome and this is fantastic! See how it looks to you.

 

Attachments

  • LimeyBuilds_SketchV3.zip
    1.2 KB · Views: 74
Last edited:
Sorry, I misunderstood what you wanted. Here is the corrected code. What you wanted was actually easier than what I coded.
 

Attachments

  • LimeyBuilds_corrected_Sketch.zip
    799 bytes · Views: 57
Sorry, I misunderstood what you wanted. Here is the corrected code. What you wanted was actually easier than what I coded.
I do apologize for being so annoying but, i wondered if it is possible to adapt this for the Beetle (DFr0282)? Not sure if it has enough inputs.
The momentary switch s pressed in once, and activated the chaser sequence. turning the main switch off and on relights them all and begins affresh. All of that is perfect. I wondered if it was possible also to havethat momentary switch do the chaser sequence on first press, and a second press can also return the program to start, lightig them all up again and prepping for the chaser? I am such a nuisance for these questions. I did try to mod it but to no avail.
 
It looks like it can be adapted to the DFR0282 if you use a +5v battery setup. The button function you're asking for is definitely possible with the Nano, but I'd have to think about how to do it. You need an interrupt handler to reset the sequence while in progress. I've never done that, so I need to look it up. You might have to change some pin assignments because D2 is the channel that can handle interrupts with the least amount of effort. I do not know if it can be done that way on the DFR0282 yet.
 
It looks like it can be adapted to the DFR0282 if you use a +5v battery setup. The button function you're asking for is definitely possible with the Nano, but I'd have to think about how to do it. You need an interrupt handler to reset the sequence while in progress. I've never done that, so I need to look it up. You might have to change some pin assignments because D2 is the channel that can handle interrupts with the least amount of effort. I do not know if it can be done that way on the DFR0282 yet.
Thank you for your time on this, it is very much appreciated! I don't know that it needs to interrupt the process, only restart the process after completing it:
1. Main switch lights LEDs.
2. Momentary switch runs chaser until LEDs are off.
3. Momentary switch resets process, all LEDs on again (the same way turning main switch off and on again restarts it)

The program you sent me works wonderfully on the nano every. Here it is in the unit with the nano every running things:



I still need to play with this new Beetle board. The unit is a little tight for space is all and the nano might make it hard to get my soundboard in.
 
Alright, that's easier. So you start with all the lights on. You press the button and they turn off in sequence. They stay off... then you press the button and they all come on and stay on until the button is pressed again. I'll think about it and put something together.
 

Your message may be considered spam for the following reasons:

If you wish to reply despite these issues, check the box below before replying.
Be aware that malicious compliance may result in more severe penalties.
Back
Top