View Single Post
  #4   Spotlight this post!  
Unread 25-02-2004, 09:12
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: Urgent!! (programming question)

Quote:
Originally Posted by ToMMan b182
if you used pbasic in prior years, you might have used the debug statement. This year in C it is printf(). What you need to do is find the placein your code where you want to print a variable and for example write

Code:
printf("Motor 1 = %d/n", motor)
Whats in quotes will be displayed on screen when you use the hyper terminal, and the %d is used in quotes to show you want to display a decimal value. the /n is a line feed.
Don't forget the comma if you happened to copy his code. You will also want to add an explicit cast to the printf. So, something like this:
Code:
printf("\nMotor 1 = %d", (int)motor);
Just replace the motor with the pwm you want. For a joystick, do something like this:
Code:
printf("\nPort 1 Y = %d, Port 2 X = %d", (int)p1_y, (int)p1_x);
You can change the port that it is outputing to whatever you want.

Or, if the values don't change too fast, you could always just use the Dashboard from the Innovation FIRST website.
__________________