Help?-Vex pro Spike Switch?

Dear Interwebs,

This is team 4254. This is our rookie year and we need a little help with programming. We have a two person programming team and we both know java from high school courses. We have our robot driving around but we are having difficulties programming the Vex Pro Spike switch. Please help us!

Thank you.

I realize that i gave no info about our problem, but we really have nothing done. We have tried many things but none of them have worked and i think if we just saw an example of code that worked it would help us out a boat load

Import the Relay class

import edu.wpi.first.wpilibj.Relay;

Create a Relay object (I’ll call mine Tom)

Relay Tom = new Relay(PORT YOU PLUGGED THE PWM WIRE INTO ON DSC);

The code to turn the spike on is something like

Tom.set(Relay.Value.kForward);

I’m not at a computer with the SDK but I’ll check with the JavaDocs to make sure this is correct in a moment.

Edit: After a quick check this seems correct. To disable the relay, use this:

Tom.set(Relay.Value.kOff);

Thank you very much. We will be sure to try that when we get our connection to the robot back…

Relay Tom = new Relay(PORT YOU PLUGGED THE PWM WIRE INTO ON DSC);

Can you please explain this part of your code in more detail?
Specifically the PORT YOU PLUGGED THE PWM WIRE INTO ON DSC part.

There are 8 relay ports on the sidecar. They are numbered from 1-8. The number corresponding to the port you plugged the PWM cable from the relay into the sidecar replaces the ā€œPORT YOU PLUGGED THE PWM WIRE INTO ON DSCā€ in the code.

The rest of the code just initializes the relay using the port. Everything is an object.

http://s15.postimage.org/adpcd3bgp/relay_Ports_On_Digital_Sidecar.png The ones in red are the relay ports

1 Like