Go Down

Topic: IR code - activation program (Read 558 times) previous topic - next topic


I'm a beginner on using the arduino. I have an arduino uno and have managed to build and modify simple circuits. I need to build a program which uses IR. I have downloaded the IR library and started experimenting. Till now I have only managed to push a button on the remote and an led is lit.

My main issue is that, I want my arduino to light up the led after a series of buttons are pressed in a particular sequence. For example 1852 and the led lights up. If the sequence is wrong, I want it to refresh the sequence. Also I would like it to refresh the sequence every 10 seconds so if part of the sequence is entered well, and time has passed, the sequence will have to be entered from the beginning.

What kind of method should I use? 

I appreciate if you help me :)



What kind of method should I use? 

An array to hold the values and millis() to notice when a new value is entered, and what time it is now. The difference between then and now will define whether to reset the array index or not.
The art of getting good answers lies in asking good questions.


Yeah, why not read the incoming codes into an array.

First check if the code is in your list of valid codes, then load it into an array.

Each time you load a code into the array, compare the array to the codes that trigger actions.

When you get a match, take the action and clear the array.

Go Up