Thread: Trig problems
View Single Post
  #8   Spotlight this post!  
Unread 18-02-2006, 01:23
revolution1737 revolution1737 is offline
Robot Overlord
FRC #1691 (Revolution1737)
 
Join Date: Feb 2006
Rookie Year: 2004
Location: Sidney
Posts: 9
revolution1737 will become famous soon enough
Re: Trig problems

Quote:
Originally Posted by Mark McLeod
Yea, you can always manipulate the value to print it.
E.g.,

Code:
#define ACCURACY 1000 //How many decimal places are important to you
float f;
int i, i2; // Might need to be longs if you have a lot of significant digits
 
f = 245.56;
 
/* Print float value */ 
i = (int) f;
i2 = (int) ((f-i)*ACCURACY);
printf("f = %d.%03d \r", i, i2); //e.g., f = 245.559

I wish I had taken a class so I knew C. Could you write it so it takes the value in degrees from get_gyro_angle() and uses it in a sin function. I have spen 9 hours (seriously) and I still cannot get the right value. Any help is greatly appreciated.