View Single Post
  #9   Spotlight this post!  
Unread 19-02-2007, 12:37
Tz0m Tz0m is offline
Registered User
FRC #0333
Team Role: Programmer
 
Join Date: Feb 2006
Rookie Year: 2006
Location: New York
Posts: 17
Tz0m is an unknown quantity at this point
Re: Looping a function

The code is:
Quote:
printf("Distance = %d", DistanceCalc(TILT_SERVO));
The code for the DistanceCalc function is:
Quote:
int DistanceCalc(int tiltS)
{
int tiltD, tiltR, dist;
tiltD = ((tiltS - 124) * 65) / 124;
tiltR = (tiltD * 3.14159265) / 180.0;
dist = 80.0 / tan(tiltR);
return dist;
}