View Single Post
  #1   Spotlight this post!  
Unread 09-02-2009, 10:48
programmr's Avatar
programmr programmr is offline
Registered User
AKA: Face
FRC #0522
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Staten Island, NY
Posts: 83
programmr is a jewel in the roughprogrammr is a jewel in the roughprogrammr is a jewel in the rough
Send a message via AIM to programmr
Question joystick and relay programming plz help!

i have

Joystick* thirdStick; //Joystick USB3
Relay* agitator; //Relay 1
Relay* agitator2; //Relay 1

thirdStick= new Joystick(3);
agitator = new Relay(1, agitator->kBothDirections);
agitator2 = new Relay(1, agitator2->kBothDirections);

if (thirdStick->GetRawButton(1)) {
agitator->Set(agitator2->kReverse);
}
else {
agitator->Set(agitator2->kOff);
}

i want to know how can i make the relay go forward and then go reverse based on either the x or y axis of the joystick: example:

x axis : left makes relay1 go rev, right makes relay1 go fwd

Please help! thank you!
__________________
"I would love to change the world but no one will give me the source code"