View Single Post
  #1   Spotlight this post!  
Unread 19-02-2012, 18:20
ekgordon2 ekgordon2 is offline
Registered User
FRC #2022
 
Join Date: Jan 2012
Location: Buffalo Grove
Posts: 5
ekgordon2 is an unknown quantity at this point
US Digital E4P Encoder Not Giving Pulse Data

Here is the problem: after connecting a US Digital Encoder, it doesn't seem to be returning any pulse data.

I wired it up by attaching Ground, 5V, and Channel A to the three prongs at Digital IO port 5 on the digital sidecar, and then connected Channel B to the signal prong at Digital IO port 6.

Here is the code I used:
Code:
#include "WPILib.h"

Encoder *myEncoder;
myEncoder = new Encoder(5,6);
myEncoder->Start();
myEncoder->SetDistancePerPulse(1); // Just something for testing.

//To print on the NetConsole Screen:
printf("Speed: %f\n", myEncoder->GetRate());
Is there anything wrong with either the wiring or the code? Thanks!
Reply With Quote