loading

Arduino pattern repeating LED help?

Hi,
Thanks for reading my question.
I've been looking for a simple arduino code that repeats a couple of button presses.
In my search I came across http://nakubu.com/post/25 this code repeats the button presses.
But the thing is it only repeats when the button is pressed and the time in-between the presses.
The program doesn't record the time the button was pressed.
Can anyone help change the code so it records a complete pattern?

TheExternalDisk

rickharris4 years ago
OK If I understand you want to repeat a pattern of button presses - so that an LED will flash the same pattern afterwards?

I don't programme in C but I can analyse the problem in pseudo code (a sort of readable english) which should be easier to code in the language of your choice:

declaire the inputs and outputs

is the button pressed
if yes count the time and store in a variable the count when the button is released
if no display the last recorded pattern

Display pattern

Turn on output for a count = to the stored value
turn off the output

check to see if button is pressed

go to the next variable and repeat display until last variable is reached.

repeat until button is pressed