View Single Post
  #13   Spotlight this post!  
Unread 10-04-2008, 10:34
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,854
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: IR Board Programming/Wiring Problems

Quote:
Originally Posted by Ryan O View Post
I'm really confused about the output. I might expect the input wired differently to be different, but input three was the loner, not four. Also, it doeesn't matter which is which at this point, because they don't change at all. At comp, we got a couple to flicker once and while, but three was always one, and it was always for a very short time before going back to 0,0,1,0
[correction] It sounds like the RC and IR Receiver are grounded to the same battery, otherwise you wouldn't see the zero (0,0,1,0) signals at rest, so to speak.

Just to be sure we're discussing the same connections I'm going to repeat back how you described your wiring in slightly different terms...

Using pin 1 on the IR receiver as wire 1, as I understand it you have:
- 1 connected to the same 12v+ that the RC is connected to
- 3 connected to the same 12v- that the RC is connected to
- 5 combined with 6 & 7 in one pwm cable connecting to three signal pins, say digital input 1,2,3 (this wire really corresponds to the third IR button LED)
- 6 with 5 above (this wire corresponds to the second IR button LED)
- 7 with 5 & 6 above (this wire corresponds to the fourth IR button LED)
- 8 is the loner connection, say to digital input 4 (this wire corresponds to the first IR button LED)

No other wires are used.
I picked digital inputs arbitrarily just to discuss them.

You see digital input 3 above staying always at "1"?

The momentary change you described before sounds normal. The pins stay high for only 100ms when the IR Receiver passes the signal along. Because it's so quick your code must catch and save the change. To get feedback try using the OI LEDs available to you to watch what the code sees (but be sure to turn off code elsewhere that may be changing the OI lights), e.g.,
Code:
static char command1=0, command2=0,command3=0;
 
if (rc_dig_in01 == 1) //Yes input 1 is really IR command 3
{
    command3 = 1;
    Switch3_LED = 1;
}
if (rc_dig_in02 == 1)//Yes input 2 is really coincidentally IR command 2
{
    command2 = 1;
    Switch2_LED = 1;
}
if (rc_dig_in04 == 1) //Yes input 4 is really IR command 1
{
    command1 = 1;
    Switch1_LED = 1;
}
The way this is written will turn the appropriate OI light on when the IR remote button is pushed, but will never turn it off. Ultimately, you might want to turn off the other lights when a new command is detected, but to get off the ground you wouldn't want a bad connection turning off the other lights. Just to test that part of the system is working.

For now try ignoring the failing connection and get your code to work with the other three signals. You can go back to the bad connection after you understand the behavior of the other three. A bad connection will always read as "1."
A good connection will normally read as "0", with a 100ms pulse at "1" when the IR remote button is pushed. If the button is held down you'll see it alternate between "1" and "0."
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 10-04-2008 at 11:55.