Log in

View Full Version : Relays only going backwards?


hyprvx
29-01-2015, 17:39
So we have one relay set on relay output 0, configured in both directions. We have boolean variables true if button 5 or 6 is held, respectively, and two while loops if those variables are true. In those loops, we have the relays set to trigger forwards or backwards, and when the code breaks out of those two loops, set back to off. The loop for backwards works perfectly; when I hold button 5, the relay triggers to go backwards. But button 6, when held, does nothing. We have stepped through the code with the debugger, and it's supposed to be setting the relay to forwards, but it does nothing. Help?

Our code is at https://github.com/caffeinatedDrummer/2151-Code

notmattlythgoe
30-01-2015, 10:39
So we have one relay set on relay output 0, configured in both directions. We have boolean variables true if button 5 or 6 is held, respectively, and two while loops if those variables are true. In those loops, we have the relays set to trigger forwards or backwards, and when the code breaks out of those two loops, set back to off. The loop for backwards works perfectly; when I hold button 5, the relay triggers to go backwards. But button 6, when held, does nothing. We have stepped through the code with the debugger, and it's supposed to be setting the relay to forwards, but it does nothing. Help?

Our code is at https://github.com/caffeinatedDrummer/2151-Code

When you step through the code with the debugger does it attempt to execute the line that sets the relay to forward?

mmaunu
30-01-2015, 11:06
Everything looks fine in the code, but...

Have you verified that you are correctly detecting button 6? The debugger shows that you are in the correct loop when button 6 is held down?

Can you tell us what the relay is controlling and show a picture of the wiring?

Joe Ross
30-01-2015, 20:50
Does the LED on the relay change when you command the relay in reverse?

hyprvx
31-01-2015, 10:04
When you step through the code with the debugger does it attempt to execute the line that sets the relay to forward?

Yes, we see it's executing relayArms.set(Relay.Value.kForward); but no light change occurs.

Have you verified that you are correctly detecting button 6? The debugger shows that you are in the correct loop when button 6 is held down?


We are detecting button 6, and the second part just answered above.

Does the LED on the relay change when you command the relay in reverse?

Yes, the relay LED changes to indicate reverse, and outputs the -12v, but does nothing on forward.

The relay is to control the motor for part of our arms mechanism.

http://i.imgur.com/eZk59ID.jpg
This is a photo of our electronics board. The spike I am pointing to is the one we wish to control. The spike on the right does not work properly and will be removed soon.

hyprvx
31-01-2015, 11:51
I would like to update to say we have solved the problem. Our connections to the RoboRIO from the Spike were in backwards, enabling us to go backwards, but not forwards. Correcting the PWM connection to the RoboRIO has fixed the problem. I haven't yet seen any replies, so if anyone has suggested such a fix, thank you for noticing the problem before we did.