Go to Post One of the cultural concepts that has emerged from the teams participating in FIRST is that ideas are worth sharing. - Alan Anderson [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
Team 51   CD-Events   CD-Media   CD-Swap   CD-Spy   FRC-Spy   Unsung FIRST Heroes   WFA
portal register members calendar search Today's Posts Mark Forums Read FAQ rules
VEXpro
The Chief Delphi Forums are sponsored by Innovation First International, Inc.
Team 221 LLC
ADVERTISEMENT

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 01-25-2012, 12:21 PM
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 : 01-25-2012 at 01:52 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 01-25-2012, 03:21 PM
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 01-26-2012, 09:20 AM
eddie12390 eddie12390 is offline
Well, at least it isn't on fire...
no team
 
Join Date: Jan 2011
Rookie Year: 2000
Location: Pittsburgh
Posts: 86
eddie12390 is an unknown quantity at this point
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 : 01-26-2012 at 09:28 AM.
Reply With Quote
  #4   Spotlight this post!  
Unread 01-26-2012, 10:28 AM
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 01-26-2012, 01:11 PM
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 01-26-2012, 04:25 PM
cgmv123's Avatar
cgmv123 cgmv123 is offline
Professional Peon
AKA: Max Vrany
FRC #1306 (BadgerBOTS)
Team Role: Electrical
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Madison, WI
Posts: 603
cgmv123 is a splendid one to beholdcgmv123 is a splendid one to beholdcgmv123 is a splendid one to beholdcgmv123 is a splendid one to beholdcgmv123 is a splendid one to beholdcgmv123 is a splendid one to beholdcgmv123 is a splendid one to behold
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.
__________________
I don't get it. We followed all the instructions exactly. Why doesn't it work?
BadgerBOTS Robotics|@team1306|Facebook: BadgerBOTS
2013 FIRST Championship Curie Division (#breakthecurse)

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), Semi-Finalist (1732/1714)
2011 Wisconsin Regional Innovation in Control Award
Reply With Quote
  #7   Spotlight this post!  
Unread 01-26-2012, 10:21 PM
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: 118
otherguy is a jewel in the roughotherguy is a jewel in the roughotherguy is a jewel in the roughotherguy is a jewel in the rough
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 07:06 PM.

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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Copyright © Delphi and Pontiac Central High School