3-Wire Devices Connection Troubleshooting

Hello!

I’m trying to connect a wheel encoder to my brain. I pushed one wire into slot A and the other in slot B far enough in that the ends were flush with the braincase (the top wire of the encoder went to slot A). To test, I opened a new project in V5, added the encoder in add device -> 3-wire -> Encoder, and selected A, B. I then wrote the following lines in main()

while (true) {
  Brain.Screen.clearLine();
  Brain.Screen.print("%f",EncoderA.position(degrees));
  wait(20, msec);
}

The brain just printed 0.00000.

I was a little confused so I moved the encoder to slots C, D, and did the same thing as before, and again I got the same result.

I figured the encoder might be defective, and I had a limit switch right next to me so I put it on slot H and wrote the following lines.

while (true) {
  Brain.Screen.clearLine();
  Brain.Screen.print(LimitSwitchH.pressed());
  wait(20, msec);
}

This time 0 was printed to the screen, even while I was holding the switch down.

Am I missing something? Thanks in advance!

start by checking the limit switch in the dashboard.
(change dashboard to digital in if necessary)

1 Like

Sorry, I forgot to say I added the limit switch in the robot config dashboard if that’s what you mean. Also, what do you mean by changing the dashboard to digital in?

I mean the V5 brain dashboard.
Go to the devices screen, then touch the 3-wire icon on the top row. Touch the box for input H and change it to digital input if necessary. See if the limit switch is causing it to change.

1 Like

Strangely I can’t access those settings. When I click on 3-wire in Device Info the display pops up for a very short time then disappears. I can access the other device tabs just fine, like battery brain and controller tabs.

VexCode says I’m running the latest version 1.0.12.

That sounds like a hardware issue, the V5 main cpu not communicating with the 3wire hardware, if the V5 is still in warranty perhaps call vex support.

Also, perhaps try again with everything unplugged from the 3wire ports, perhaps one sensor is causing power to be disabled.

3 Likes