View Single Post
  #2   Spotlight this post!  
Unread 17-02-2006, 23:00
Bob Koehl Bob Koehl is offline
Engineer
no team (The MEZ)
Team Role: Mentor
 
Join Date: Nov 2001
Rookie Year: 2000
Location: Detroit, MI
Posts: 7
Bob Koehl is a jewel in the roughBob Koehl is a jewel in the roughBob Koehl is a jewel in the rough
Re: Pot Printf Variable

See this example from the IFI programming guide (2004-programming-reference-guide-12-apr-2004.pdf) page 16:
/* Example of using the Analog Inputs to map an analog input to a PWM output. */
unsigned int sensor1;
unsigned char sensor1_8bits;
sensor1 = Get_Analog_Value( rc_ana_in01 ); /* Assign the analog reading to a variable. */
sensor1_8bits = (unsigned char)(sensor1 >> 2); /* Only take the 8 most significant bits, */
pwm01 = sensor1_8bits; /* because PWM OUTPUTS can only be 8 bits. *

printf("Pot value: %d\r\n", variableNameUsedForPot);
would be
printf("Pot value: %d\r,(int)sensor1);

Hope this helps.
__________________
Bob Koehl
Michigan Engineering Zone Mentor
VP/Secretary DADARA