Arduino Nano sketches for LED animation help

LimeyBuilds

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
 

LimeyBuilds

Member
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.
 

13doctorwho

Sr Member
RPF PREMIUM MEMBER
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
 

LimeyBuilds

Member
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
 

13doctorwho

Sr Member
RPF PREMIUM MEMBER
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: 20

LimeyBuilds

Member
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!
 

LimeyBuilds

Member
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: 12
Last edited:

13doctorwho

Sr Member
RPF PREMIUM MEMBER
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: 15

LimeyBuilds

Member
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.
 

13doctorwho

Sr Member
RPF PREMIUM MEMBER
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.
 

LimeyBuilds

Member
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.
 

13doctorwho

Sr Member
RPF PREMIUM MEMBER
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:

  1. Your new thread title is very short, and likely is unhelpful.
  2. Your reply is very short and likely does not add anything to the thread.
  3. Your reply is very long and likely does not add anything to the thread.
  4. It is very likely that it does not need any further discussion and thus bumping it serves no purpose.
  5. Your message is mostly quotes or spoilers.
  6. Your reply has occurred very quickly after a previous reply and likely does not add anything to the thread.
  7. This thread is locked.
Top