View Single Post
  #4   Spotlight this post!  
Unread 09-01-2004, 11:06
Mark McLeod's Avatar
Mark McLeod Mark McLeod is offline
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,793
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Some EDURobotics Problems

Quote:
Originally Posted by squide
Thanks for the reply!

We're using an optical sensor to test for input without modifying the Default Code besides the printf statement. We put the sensor in Pin 6 (rc_dig_in06), so with the default configurations it should be okay. It also behaved the same in 8 & 10.

Lets try this tack then just to make sure it isn't a printf issue.
What does your printf look like and how are the variables you use in it declared? Just to make sure you are seeing the correct values.
The printf implementation will give you bad results that look right if you treat it as a normal C printf.
e.g.,

unsigned char digitalvalue;
unsigned int analogvalue;

digitalvalue = (unsigned char) rc_dig_in06;
analogvalue = (unsigned int) Get_Analog_Value(rc_ana_in01);

printf("My digital value %d, My analog value %d", (int) digitalvalue, (int)analogvalue);

We wrote our own print functions to get what we want, especially since printf takes up so much space. You can get the same functionality in 40 bytes rather than the 4000 or so printf takes up.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 09-01-2004 at 11:10.