Printing times after five squences to lcd display

Hi,

I have a issue I like to figure out if it is doable.

So I have a sequense where leds are on and off as follows:

red led on 7 seconds, green led on 3 seconds. this is repeated 5 times. While the green led is on I would like to measure reaction time from sound and be able after this cycle fully ends print out to the lcd-display those five times.

Any ideas?

Best regards

Timo McKeown

tmckeown:
measure reaction time from sound

Reaction time of what? Print out what?

What do you know how to do ?

Turn an LED on and off ?
Determine whether the state of an input pin is HIGH or LOW ?
Write text to the LCD ?
Measure the time between two events ?
Do you know what a for loop is ?
Do you know what an array is and how to save values to it and read them back ?

Hi Bob,

I now know how to make those led do the sequense five times.

I would like to get those reaction times somehow on the display, so I would be able to see after those five times when green led is on that how long from the led turning green does a sound come. Is it 2,5 seconds or what? and so that I can see all those 5 times at the same time.

No I have no idea YET what is an array or how to save or read from it.

Timo

No I have no idea YET what is an array or how to save or read from it.

An array is a way of temporarily holding a set of values of the same type, in your case a set of times. You store or access each individual entry in the array using an index. You want to store 5 times so you will need 5 entries and the index will be numbered from 0 to 4.

What method do you know to make the LEDs do the sequence 5 times. A for loop sounds like it might be useful and if you use a loop from 0 to 4 you can use the value as the index to the array. Once you have saved the 5 values you can access and display them using a second for loop.

You will need something to make the sound and stop the timer. What devices have you got in mind ?

Have a look at the demo several things at a time which illustrates how to use millis() to manage timing of blinking LEDs and other things.

...R

Hi,

Sounds will be external loud "clap" etc.. and I was thinking of using microphone as a sound switch

Timo

Okay, start easy. Have you build a circuit to use a microphone as a switch? Make a simple sketch to turn on and off an LED with a clap. If that's to hard, drop the idea and start to read about how to do it.

Voice acticated switch is a piece on cake, programming is not
But I try to learn...

Timo