View Single Post
  #8   Spotlight this post!  
Unread 15-01-2004, 00:19
Just3D Just3D is offline
Programmer/Electrical Sys
AKA: Justin Layne Nordin
#1460 (Robolution)
Team Role: Programmer
 
Join Date: Jan 2004
Location: Houston, Texas
Posts: 4
Just3D has a little shameless behaviour in the past
Re: Trouble with pwm outputs

If for some reason you get the power set up once more and it still fails, try this, it will help clear up any future printf statements:

Code:
printf("%d\n", &pwm02);
Notice the ampherstand (&). This will tell printf to read the value of pwn02 rather than the memory address of pwn02 (this is why 10000 or so seemed so out of range; memory addresses range all the way up to the maximum RAM).

As for the digits between the % and the 'd', lpramo55 was right in saying the number controls the number of digits output. If you write a 3, it will display 3 digits, adding zeroes as necessary. This also works with decimal places. For example: If you wrote

Code:
float f = 34.67;
printf("%2.1f", &f);
The output would be 34.7, rather than 34.670000.
The number between the '%' and the 'f' in this case represents 2 digits, plus a decimal point, plus 1 additional digit.

Hope this helps!

NOTE: Do not use floats with the robot programming because it has no floating point processor. Instead, stick to ints and unsigned chars, using "%i", and "%d" as needed.

Last edited by Just3D : 15-01-2004 at 00:22. Reason: Clarify information.