Hello I connected An encoder to a roboRIO to get a value and it doesn"t give any value anyone knows why?
What encoder? Are the encoder’s lights working? What code are you using to collect the encoder data?
“I drove my car down the road and now it doesn’t work. Why?”
Seriously though, we need more information to even guess at the problem.
- What type of encoder?
- How/where is it connected?
- What makes leads you to believe it’s not working?
Some casual reading if you find the time: How To Ask Questions The Smart Way
An absolute encoder
Connected to roborio
It doesn"t give any value in the shuffleboard
Which exact model of encoder? Exactly how is it wired and connected – which pin is going to which other pin, or which pre-made cable are you using? What language are you using? Link to (or past of) code may be needed…
Its a REV through bore encoder, we are using a pre made JST 6 pin cable (the one with many dupont exits) and we are using it’s white cable (rev says it what should be connected to the roborio)
This cable? Can you elaborate on what you mean by “white cable”?
Also, the roborio has about 100 pins on it, so you’re going to need to be more specific.
Yes, we are using this cable and connecting it to the DIO in the roborio. (We are connecting the end with the white cable)
That won’t work. Check the docs here for how to wire it the way you want (quadrature/relative vs duty-cycle/absolute)
I stand corrected. You have that part right.
Can you confirm signal (white) is on the correct (“S”) pin?
If so, can you share your code (ideally as a link to github or similar)?
static DutyCycleEncoder encoder = new DutyCycleEncoder(3);
@Override
public void robotPeriodic() {
CommandScheduler.getInstance().run();
SmartDashboard.putNumber("encoderValue", encoder.getAbsolutePosition());
}
thats the part of the code. its in the Robot.java class
Is the encoder connected to DIO rail 3? Make sure the colors are correct as well - at the bottom of the row of pins, there are labels. I believe the black (ground) wire should face the outside of the RIO, but double-check. S is for signal (white), 5V is your power (red), and ⏚ is your ground (black).
yes we connected the cable correctly.
Can you send a photo of how it’s all set up? Also make sure that the small switch on the side of the encoder is set to A
.
This sounds almost exactly like this other thread: REV Through Bore Encoder on DIO pins not working. It’s worth following that one. Your wiring seems good. I don’t see anything obvious in your code, but double check the “3”.
I just double checked with a Rev through bore I’ve had for a few years, and its working fine. I wonder if theres a miswire in the connector. On the 6 pin side, what order are the pins? They should be
Black, Green, Yellow, Blue, Whie, Red
we solved the problam one of our roboRIOs DIO didn"t work thank you all for helping us