View Single Post
  #3   Spotlight this post!  
Unread 01-02-2008, 16:01
scottanderson's Avatar
scottanderson scottanderson is offline
Software Architect
AKA: Scott Anderson
FRC #2608 (MiGHT)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2008
Location: Shelby Township
Posts: 20
scottanderson is an unknown quantity at this point
Re: Strange gear tooth sensor port issue

WPILib's "GetGTSensor" routine, from the latest release of WPILib.

The code is simply this:

void main(void) {
StartGTSensor(1, 0);
StartGTSensor(2, 0);

while (1) {
printf("1: %d 2: %d 3: %d 4: %d\n", GetGTSensor(1), GetGTSensor(2), GetGTSensor(3), GetGTSensor(4));
}
}

The gear tooth sensors are plugged into ports 1 and 2.

Output:

1: 0 2: <port 1 output> 3: 0 4: <port 2 output>
...

If I invert instead:

StartGTSensor(1, -1);
StartGTSensor(2, -1);

then I see this:

1: -1 2: <port 1 output> 3: -1 4: <port 2 output>
...

Regards,
-scott