Log in

View Full Version : IR help


program1
29-01-2008, 20:23
i have absoulutly no idea how to program the IR. can someone post a sample code so i know what it looks like please?

kevin.li.rit
29-01-2008, 20:28
You plug the IR board into the Digital IO and program it just like you would a switch.

if(!rc_dig_in15)
{command1();
}

Something like that.

popo308
29-01-2008, 20:29
i have absoulutly no idea how to program the IR. can someone post a sample code so i know what it looks like please?

Are you using MPLab??

program1
29-01-2008, 20:32
yea, im using MPLab

popo308
29-01-2008, 20:40
yea, im using MPLab

ok so if you just have


if (rc_dig_in01 == 1)
{
run mottors == XXX
}

then just

if(rc_dig_in02 == 1)
{
run motors == XXX
}

and repeat that for all 4 commands

you just need to tell it was motors to run when you hold the button down...



PM me if you need more help

kevin.li.rit
29-01-2008, 20:43
I thought it gave you a 0 in programing when you sunk the pull ups of the digital IO to ground. Am I wrong?

popo308
29-01-2008, 20:47
I thought it gave you a 0 in programing when you sunk the pull ups of the digital IO to ground. Am I wrong?

thats what i thought as well but we hooked ours in and its giving us 1's....

wt200999
29-01-2008, 20:48
Yeah the IR gives you 1's

kevin.li.rit
29-01-2008, 20:48
I haven't hooked ours up yet. It could be possible the IR receiver board sinks it to 0 when there is no IR signal. Probably what's happening I guess.

popo308
29-01-2008, 20:50
I haven't hooked ours up yet. It could be possible the IR receiver board sinks it to 0 when there is no signal. Probably what's happening I guess.

also you are pulsing voltage into the RC where as connecting the pins is a ground to signal connection... that could be why

kevin.li.rit
29-01-2008, 20:54
also you are pulsing voltage into the RC where as connecting the pins is a ground to signal connection... that could be why

What I assume is happening is that the output pins on the PIC on the IR board, is set to 0 which would ground the signal on the RC and give a 0. When it sees the IR pulse it changes the output pin to 1 which is a high 5V. That would give you a 1 in programming.

popo308
29-01-2008, 20:58
What I assume is happening is that the output pins on the PIC on the IR board, is set to 0 which would ground the signal on the RC and give a 0. When it sees the IR pulse it changes the output pin to 1 which is a high 5V. That would give you a 1 in programming.

yep exactly

RyanN
29-01-2008, 21:59
Here is something I wrote in another thread. It's pretty much completely ready, and will work (as I found out today, because we didn't have power going our IR board and it came back as an error :D)

http://www.chiefdelphi.com/forums/showpost.php?p=687711&postcount=19