Go to Post My father taught me long ago that how we respond to adversity is what defines us as human beings. Let's all keep this definition in mind as we move forward to change a culture. - Rich Kressly [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-01-2012, 13:21
Cheeset2 Cheeset2 is offline
Registered User
FRC #4254
 
Join Date: Jan 2012
Location: New York
Posts: 9
Cheeset2 is an unknown quantity at this point
Smile 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.

Last edited by Brandon Martus : 25-01-2012 at 14:52.
Reply With Quote
  #2   Spotlight this post!  
Unread 25-01-2012, 16:21
Cheeset2 Cheeset2 is offline
Registered User
FRC #4254
 
Join Date: Jan 2012
Location: New York
Posts: 9
Cheeset2 is an unknown quantity at this point
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
Reply With Quote
  #3   Spotlight this post!  
Unread 26-01-2012, 10:20
eddie12390's Avatar
eddie12390 eddie12390 is offline
Registered User
AKA: Eddie
FRC #3260 (SHARP)
Team Role: Programmer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Pittsburgh
Posts: 285
eddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of lighteddie12390 is a glorious beacon of light
Re: Help?-Vex pro Spike Switch?

Quote:
Originally Posted by Cheeset2 View Post
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);

Last edited by eddie12390 : 26-01-2012 at 10:28.
Reply With Quote
  #4   Spotlight this post!  
Unread 26-01-2012, 11:28
Cheeset2 Cheeset2 is offline
Registered User
FRC #4254
 
Join Date: Jan 2012
Location: New York
Posts: 9
Cheeset2 is an unknown quantity at this point
Re: Help?-Vex pro Spike Switch?

Quote:
Originally Posted by eddie12390 View Post
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....
Reply With Quote
  #5   Spotlight this post!  
Unread 26-01-2012, 14:11
Cheeset2 Cheeset2 is offline
Registered User
FRC #4254
 
Join Date: Jan 2012
Location: New York
Posts: 9
Cheeset2 is an unknown quantity at this point
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 26-01-2012, 17:25
cgmv123's Avatar
cgmv123 cgmv123 is offline
FRC RI/FLL Field Manager
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: College Student
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 2,073
cgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond reputecgmv123 has a reputation beyond repute
Re: Help?-Vex pro Spike Switch?

Quote:
Originally Posted by Cheeset2 View Post
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.
__________________
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2016 FIRST Championship Tesla Division | 2016 Wisconsin Regional Engineering Inspiration Award

2015 FIRST Championship Carson Division | 2015 Wisconsin Regional Chairman's Award

2013 FIRST Championship Curie Division | 2013 Wisconsin Regional Chairman's Award

2012 FIRST Championship Archimedes Division | 2012 Wisconsin Regional Engineering Inspiration Award, Woodie Flowers Finalist Award (Lead Mentor Ben Senson)

Reply With Quote
  #7   Spotlight this post!  
Unread 26-01-2012, 23:21
otherguy's Avatar
otherguy otherguy is offline
sparkE
AKA: James
FRC #2168 (The Aluminum Falcons)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: CT
Posts: 429
otherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to beholdotherguy is a splendid one to behold
Re: Help?-Vex pro Spike Switch?

The ones in red are the relay ports
__________________
http://team2168.org
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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