Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Help?-Vex pro Spike Switch? (http://www.chiefdelphi.com/forums/showthread.php?t=101112)

Cheeset2 25-01-2012 13:21

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.

Cheeset2 25-01-2012 16:21

Re: Help?-Vex pro Spike Switch?
 
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

eddie12390 26-01-2012 10:20

Re: Help?-Vex pro Spike Switch?
 
Quote:

Originally Posted by Cheeset2 (Post 1113435)
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
Code:

import edu.wpi.first.wpilibj.Relay;
Create a Relay object (I'll call mine Tom)
Code:

Relay Tom = new Relay(PORT YOU PLUGGED THE PWM WIRE INTO ON DSC);
The code to turn the spike on is something like
Code:

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:
Code:

Tom.set(Relay.Value.kOff);

Cheeset2 26-01-2012 11:28

Re: Help?-Vex pro Spike Switch?
 
Quote:

Originally Posted by eddie12390 (Post 1113821)
Import the Relay class
Code:

import edu.wpi.first.wpilibj.Relay;
Create a Relay object (I'll call mine Tom)
Code:

Relay Tom = new Relay(PORT YOU PLUGGED THE PWM WIRE INTO ON DSC);
The code to turn the spike on is something like
Code:

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:
Code:

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....

Cheeset2 26-01-2012 14:11

Re: Help?-Vex pro Spike Switch?
 
Code:

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.

cgmv123 26-01-2012 17:25

Re: Help?-Vex pro Spike Switch?
 
Quote:

Originally Posted by Cheeset2 (Post 1113977)
Code:

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.

otherguy 26-01-2012 23:21

Re: Help?-Vex pro Spike Switch?
 
The ones in red are the relay ports


All times are GMT -5. The time now is 10:38.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi