IR programming and wiring difficulties

Hey everyone i have a few questions that i would like to ask.

FIRST of all…i want to make sure that the IR wires should be plugged into the signal pin of the digital input robot controller.
I run easy C and when i run the terminal program on it, it tells me that the robot is sensing the ir sensor but all the inputs are always at one, and then when you press one of the ir buttons it changes the three that aren’t being used to zero. Is this what is suppose to happen??

i also haven’t been able to get the robot to respond with any of my programs can somebody give me an example program to work with to make this right??? thanks for all the help

Adam (progammer)

This is what you’ll see if you power the IR sensor board with a different battery than the one powering your controller. It’ll operate fine just the grounds are not common between the two devices as they would be on the robot where both the RC and the IR sensor would both use the same 12v ground.
Is that what you are doing?

You can just program around the all 1’s business by checking the pins and only capturing the IR sensor command when three of them drop to zero.

If you are testing the pins one-by-one be careful to take the first non-1 result you get and save that command. Then don’t do anything until they all go to 1 again (or all 0’s). Otherwise, you could have the pins start to change back while you are testing them and think several of the cmd signals were sent. There are easier/safer ways to handle this in straight C by plugging into digital input pins 15-18 and capturing all the pins simultaneously via (PORTJ>>4).

i got the 0 thing fixed you were right, but i still can’t seem to type in anything that will get the robot to work with the IR sensor

P.S. For Easy C specific questions post in the Easy C Pro sub forum:

Maybe something simple like this, although I warn you I didn’t test this on a robot yet.

unsigned char IRcmd1;
unsigned char myservo=0;
    IRcmd1 = GetDigitalInput(1);
    if(IRcmd1 !=0)

Plug a servo into PWM1.
Add a backup battery since that’s all that power things plugged into the pwm outputs.
The servo should move from one extreme to the other when the correct button is pushed.
You’d have to cycle the power to get it to reset.

testprog.doc (102 KB)

testprog.doc (102 KB)