Thread: Encoder help
View Single Post
  #2   Spotlight this post!  
Unread 16-02-2007, 11:02
JBotAlan's Avatar
JBotAlan JBotAlan is offline
Forever chasing the 'bot around
AKA: Jacob Rau
FRC #5263
Team Role: Mentor
 
Join Date: Sep 2004
Rookie Year: 2004
Location: Riverview, MI
Posts: 723
JBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond reputeJBotAlan has a reputation beyond repute
Send a message via AIM to JBotAlan Send a message via Yahoo to JBotAlan
Re: Encoder help

Quote:
Originally Posted by Alan Anderson View Post
How are you printing it? Note that the function returns a long integer. If you're trying to print it with a %d format, you'll only get the topmost two bytes.
That's what I was thinking too--printf() is very particular about the data type coming in.

To print out the encoder count, you could typecast it to an int for printf:
Code:
printf("Encoder 1 is %d\r\n", (int)Get_Encoder_1_Count());
would do it, I think.

I can't seem to find the documentation for the printf function, so I can't give you the %whatever value you need to make a long int print...I'm not even sure if it's possible directly. Just typecast it as I showed, and it should give you a good value out.

JBot
__________________
Aren't signatures a bit outdated?