View Single Post
  #5   Spotlight this post!  
Unread 24-01-2009, 09:10
GGCO's Avatar
GGCO GGCO is offline
Registered User
AKA: Grant
FRC #3357
Team Role: Alumni
 
Join Date: Jan 2008
Rookie Year: 2004
Location: Michigan
Posts: 406
GGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to beholdGGCO is a splendid one to behold
Send a message via AIM to GGCO
Re: Programming Joystick Buttons to toggle a motor on and off

This is how my team did it.

// this is all in our autonomous loop....
bool buttonUp = leftStick->GetRawButton(1);
bool buttonDown = leftStick->GetRawButton(2);
bool buttonStop= leftStick->GetRawButton(3);
float elevatorSpeed; // this is the speed of our elevator
if (buttonUP){
elevatorSpeed(1.0);
}
else if (buttonDown){
elevatorSpeed(-1.0);
}
else if (buttonStop){
elevatorSpeed(0.0);
}

ElevatorMotor1->Set(elevatorSpeed); // elevator motors one and two are
ElevatorMotor2->Set(-elevatorSpeed);// on both sides of our elevator
__________________
"Great spirits have always encountered violent opposition from mediocre minds" - Albert Einstein
The FIRST Alliance
COMETS Robotics
Website

Reply With Quote