View Single Post
  #5   Spotlight this post!  
Unread 24-01-2009, 01:09
Pancake Pancake is offline
Registered User
FRC #0991 (The Dukes)
Team Role: Photography
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Phoenix
Posts: 11
Pancake is an unknown quantity at this point
Re: Joystick Buttons

To use "printf", simply do
Code:
printf("Hello World!");
Or if you want to print a variable:
Code:
float number = 7.241;
printf("The value is: %f", number); // The value is: 7.241
And you need the cRIO connected to your computer via a serial cable to see the output

For the joystick issue, (I haven't actually tested it myself), I think it should work like:
Code:
Joystick stick(1); // Joystick plugged into USB port 1
Servo sv1(5); 


if(stick.GetRawButton(2))
{
    // Set the servo
    sv1.set(someAngle);
}
Hope this helps, haven't actually tried this myself
Reply With Quote