![]() |
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" |
Re: US Digital E4P Encoder Not Giving Pulse Data
How are you turning the shaft the encoder is on? How long are you waiting between calling Start() and calling GetRate()? The rate might be slow enough that it's effectively zero. What does it return for the distance?
|
Re: US Digital E4P Encoder Not Giving Pulse Data
Similar to Alan's comment - but if not obvious...you need to call "GetRate()" again and again in your OperatorControl() loop. Are you able to get printf() data via NetConsole? Or are you using SmartDashboard? If so, make sure you print out these items so you can get a sense of whether or not it is working properly. Also, if GetRate() is returning nothing of interest, I'd suggest calling GetRAW() and printing that out or plotting it on SmartDashboard. GetRAW should be an ever-increasing counter.
Now, if you're doing all that and it's not working, here's what we did to diagnose a bad hardware situation... If your inputs from the Encoder are on digital IO's 5 and 6, plot the values of those digital inputs on 5 and 6 to ensure they are both changing when the shaft is spun. We found that one of our inputs was bad from the encoder and threw it in the trashcan. Code:
// Testing encoder digital IO's without actually using the encoder class...bob - Team 1967 - The Janksters |
| All times are GMT -5. The time now is 17:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi