View Single Post
  #2   Spotlight this post!  
Unread 01-02-2008, 16:19
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Strange gear tooth sensor port issue

Quote:
Originally Posted by scottanderson View Post
Code:
printf("1: %d   2: %d   3: %d   4: %d\n", GetGTSensor(1), GetGTSensor(2), GetGTSensor(3), GetGTSensor(4));
The problem is probably with the printf() statement, not with the Gear Tooth Sensor code. You're asking for four ints to be printed. It looks like GetGTSensor() returns a long. The first %d will show the first 16 bits of GetGTSensor(1), the second %d will show the rest of GetGTSensor(1), the third will show the first 16 bits of GetGTSensor(2), etc.

If this is the case, you can correct the problem either by printing the values using %ld, or by casting them as (int).