ADICON Support Forum Applied Digital, Inc.
Page 1 of 1 1
Topic Options
#19248 - 01/13/08 05:06 PM comaads based on Multiple IR commands received
ncc Offline
newbie


Registered: 03/20/07
Posts: 5
Hi. I know im missing something, but i just cannot find it. I want the Ocelot to work in this manner:

I want to send a <0><1><0><2><0><3><0><4> as ir codes to the ocelot and then have it do something.

For example, sending [ir code for 0] followed by [ir code for 1] followed by [ir code for 0] followed by [ir code for 2] followed by [ir code for 0] followed by [1r code for 3] followed by [ir code for 0] followed by [ir code for 4] will then tell the Ocelot to do something.

The IR codes will be sent programatically to the Ocelot via a different application. All commands sent to the Ocelot will ALWAYS be a series of 8 ir commands.

How would I code this?

Thanks,




Edited by ncc (01/13/08 05:09 PM)

Top
#19250 - 01/13/08 06:08 PM Re: comaads based on Multiple IR commands received [Re: ncc]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
The best approach would be a type of "binary tree" that advances with each code received. Each received code would be compared against a list of possible previous sequences. This works as long as the total number of possible sequences is not too great!

For example:

IF IR #1 is Received //if initial code #1 is received
THEN Variable #1 = 1 //then status is 1

IF IR #2 is Received //if initial code #2 is received
THEN Variable #1 = 2 //then status is 2

...


IF IR #1 is received //if a second valid code is received
AND Variable #1 = 1 //and the status is 1
THEN Variable #1 = 10 //then this is branch 1 of the tree

IF IR #1 is received //if a second valid code is received
AND Variable #1 = 2 //and the status is 2
THEN Variable #1 = 20 //then this is branch 2 of the tree

...

etc.


As you can see, this can multiply quickly. When the last code is received, you then do your action and reset the status to 0. You could also start a timer with the first code and if it times out without having triggered any action due to no valid last code having been reached, then the status is reset to 0 automatically. A "cancel" IR code could also be used to reset the status to 0.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
#19252 - 01/13/08 06:29 PM Re: comaads based on Multiple IR commands received [Re: Guy Lavoie]
ncc Offline
newbie


Registered: 03/20/07
Posts: 5
Thanks Guy. Thats the approach i was taking and figured there must be something simpler. there is a lot of room for timing errors using a var set tree. :-)
Top
#19857 - 04/30/08 09:49 PM Re: comaads based on Multiple IR commands received [Re: Guy Lavoie]
Trev Offline
junior


Registered: 03/16/08
Posts: 32
Hi, I have a similar question. I too wish to send IR commands but I want to send IR 1 and IR 2 to do a task and also want to send IR 1 and IR 3 to do some thing else. I am trying to control the light level of the various house lights. What are your suggestions?
Trev.

Top
#19863 - 05/02/08 06:49 AM Re: comaads based on Multiple IR commands received [Re: Trev]
Guy Lavoie Administrator Offline
Beyond All Hope
*****

Registered: 12/21/02
Posts: 6401
Loc: Montreal, QC, Canada
The approach would be similar. The first code (IR1) would "arm" the routine (by starting a timer) to expect a second IR code and then do an action based on which one is received. A timer is used as the flag so that if it doesn't receive a second valid IR code within a few seconds, it resets to looking for that first code again. Like this:

IF IR #1 is Received //if initial code #1 is received
THEN Timer #1 = 1 //start inactivity timer.

IF IR #2 is received //if a second valid code is received
AND Timer #1 is > 0 //and inactivity timer is running
THEN Timer #1 = 0 //stop inactivity timer.
THEN (do action #1)...

IF IR #3 is received //if a second valid code is received
AND Timer #1 is > 0 //and inactivity timer is running
THEN Timer #1 = 0 //stop inactivity timer.
THEN (do action #2)...

IF Timer #1 becomes > 10 //if no second IR is received within 10 seconds
THEN Timer #1 = 0 //stop inactivity timer.
_________________________
"If you don't know what you're doing, do it neatly..."

Top
Page 1 of 1 1


Moderator:  Dan Smith, Monte G, ADI Tech Support, Guy Lavoie 
Hop to:
Who's Online
3 registered (pbir, Bent, Martin in Texas) and 31 anonymous users online.
Recent Posts
SECU16IR Output Connecting To A Xantech Connecting Block
by Jean-Marie
Today at 08:36 AM
SECU16IR Output Connecting To A Xantech Connecting Block
by Jean-Marie
Today at 08:34 AM
how to post an icon
by manu
02/03/12 03:40 AM
Command Pair
by kuro
02/01/12 12:49 AM
Does anyone have a copy of the latest TSE?
by sevenzenith1
01/30/12 05:17 AM
Shout Box

Newest Members
feshh, manu, kuro, chuck214, Funkhauser
2747 Registered Users
Forum Stats
2747 Members
19 Forums
3837 Topics
22713 Posts

Max Online: 67 @ 08/16/11 03:08 PM
February
Su M Tu W Th F Sa
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29