View Single Post
  #2   Spotlight this post!  
Unread 20-01-2005, 01:54
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Analog Input Trouble

Quote:
Originally Posted by Matt Krass
My co-programmer and I are having some trouble with the RC. We've tried both a potentiometer and a gyro connected to the first analog input. I tried to get the raw value using:
Code:
printf("Raw value: %d\n", Get_Analog_Value(rc_ana_in01));
but it just prints -1. Any suggestions ?

Using newest compiler/IDE, firmware's updated and we're using newest default code.
The compiler doesn't seem to handle this very well. I've taken to just using a temporary variable for the return value of a function, then pass the value of the temporary variable into printf. Try this:

unsigned int temp_analog_value;

temp_analog_value = Get_Analog_Value(rc_ana_in01);
printf("Raw value: %u\n", temp_analog_value);

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org