Need help getting spike relays working


Relay hopper;

hopper(1);

if(joybutton(1));
{
  hopper.Set(Relay::kOn);
  hopper.Set(Relay::kForward);
}

It doesnt do anything at all.

How do I get the spike relays working to test?

Ok, for my code, I don’t need the kOn at all.

Is the PWM wire properly plugged into the Relay side of the DSC instead of the PWM side?

Also when the button is pressed, what do the lights next to slot 1 of Relay do?

And do the lights on the Spikes change?

If the answer to the first 2 are yes, and the third no, try messing with the wire more (or a different 1).

SideNote:
WhooHoo, 100 posts!
And congrats on your 1st post!

  1. Yes but both were tried
  2. the lights don’t even come on
  3. the lights don’t change

By any chance are the lights on the Relay side red by even when not enabled?
Also are all 3 green lights on the DSC?

Check out Relay.cpp in WPILib. Relay have a direction, kOn sets both forward and reverse. kForward sets only forward. If it was wired correctly, I’m guessing you want to remove the kOn call.

KC

Relays won’t do anything if the robot is disabled. Did you enable it from the Driver Station when you ran the test?