Log in

View Full Version : GetRxInput vs GetOIDInput


Whelch
02-06-2010, 11:40
I'm a very inexperienced programmer so if this question sounds dumb, i appologize in advanced. I'm doing a school poject with my robotics team and we're programming a very basic robot, but easier said than done when you don't know how to program in the first place.

We're using the MPlab environment, and i've got two questions to ask.

1) what is the difference between Get|OID - OIA - Rx|Input?

am i to understand OIA gives values between 0-255? and is reserved for ports 1-4?
and OID is 5/6 and either 1/0?
and Rx is whatever the port delivers?
well if this is the case, then how am i able to use (and the robot does what i want when i do) OID for ports 1-4 (but not 5-6) and Rx compiles and returns an error 'could not find definition of symbol 'GetRxInput''? (OIA for ports 1-2 work (and i havn't tested for 3-4 because i don't need them))

the second question i have is. . .

2) how can i get more than just 2 (or in my bizare case, 4) digital inputs from one controller?

also, we're using WPIlib - - i don't know if that's obvious or not but yeah . . .

Whelch
03-06-2010, 15:44
the IFI controller

Whelch
03-06-2010, 15:51
Also, completely seperate question, but how do you set a relay motor hooked up to a spike in reverse?

my current code (in c) is as follows

...

SetRelay(8,0,0) //neutral
if(GetOIDInput(2,3) == 1) //hold forward
{
SetRelay(8,0,1)
}
if(GetOIDInput(2,4) == 1)//hold reverse
{
SetRelay(8,1,0)
}

The forward motion works, and stopping it works if neither are held, but i can't get the motor to run backwards.
I've even tried switching the two SetRelay() calls for kicks and giggles, and unsuprisingly, the reverse still does not work and the forward does.

helps me plox!!