NEW PROJECT: Custom Strobe Flasher

Hello Guys!!

I am working on my first ‘permanent’ project. And I could use a little help.

But first, a little back story:

I got two sets of those el cheapo LED light bars off of ebay for free. I got them installed on my truck and was very disappointed with the flash patterns. A normal person would have just got a different flash box off of Amazon, but of course I opt to do things the hard way. I have an Arduino (UNO R3) laying around and in a moment of pure genius decided I should make my own flasher. Since the LED’s run off the 12v straight from the car battery, I have a bank of 12 MOSFETs to switch the ground on and off for them. Hopefully that was a good choice. The plan is to have the 12v going into the Vin on the Arduino. Is that ok or should I through in a 5v voltage regulator? Then I bought on of the VKey Voltage Keypad off of SF and am planning on using that so that I can select from 12 different flash patterns.

Here’s the problem:

How do I have a flash pattern running while checking to see if the user is pressing one of the other buttons to change the flash pattern?

I am a little stumped here. I hope I don’t have to have two Arduino to do this, one monitoring the keypad while the other controls the flash pattern.

Any help/direction is greatly appreciated! Thanks

Blenderite

Check into a state machine. The loop will check for inputs and check to see if it’s time to change the flashing.

google “arduino state machine” - you’ll see many links to this type of programming.

I am having a little trouble figuring out how to incorporate the keypad. The state machine method makes sense, but i cant get the keypad to work correctly. It returns multiple buttons each time i hit a single button. Any ideas that could help steer me in the right direction?

Ok here is some more details on what I am running into:

That is what happens when I hit button 1. If I hit button 12, it works correctly, showing 12 and then 0. No other button works correctly. If I run it without the state machine code, it works fine.

I have worked on this all day and have gotten no where. I am about ready to forget the state machine and just use another Arduino. This is taking so much time, it is no longer worth it. Unless someone wants to post up some actual code that should atleast get me to the point of programming the flash patterns, cause I am completely lost here.

Is there a better way to do this? Should I just not use the keypad for this project?