Go to Post Quote from my mentor: "Keep things as complex as necessary, and not a bit more." - Mike [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 26-10-2014, 17:38
Emiko Emiko is offline
Registered User
None #2439
 
Join Date: Aug 2013
Rookie Year: 2013
Location: Hawaii
Posts: 5
Emiko is on a distinguished road
Need a Code for Solenoid to Shift

Hi, I'm a new programmer. I've been assigned the task to make a solenoid shift when a button is pushed (such as buttons 4 and 5 on a joystick [tank drive]).
If anyone has a fully functional code that allows a solenoid to shift with a push of a button, please reply with it here. It would be very helpful and I'd really appreciate it.
Thank you!
  #2   Spotlight this post!  
Unread 26-10-2014, 17:55
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,078
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: Need a Code for Solenoid to Shift

What language?
__________________
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)

  #3   Spotlight this post!  
Unread 26-10-2014, 17:56
Emiko Emiko is offline
Registered User
None #2439
 
Join Date: Aug 2013
Rookie Year: 2013
Location: Hawaii
Posts: 5
Emiko is on a distinguished road
Re: Need a Code for Solenoid to Shift

English.
  #4   Spotlight this post!  
Unread 26-10-2014, 18:00
cjl2625's Avatar
cjl2625 cjl2625 is offline
apel py
AKA: Cory Lynch
FRC #2067 (Apple Pi)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Guilford, CT
Posts: 412
cjl2625 is a splendid one to beholdcjl2625 is a splendid one to beholdcjl2625 is a splendid one to beholdcjl2625 is a splendid one to beholdcjl2625 is a splendid one to beholdcjl2625 is a splendid one to beholdcjl2625 is a splendid one to beholdcjl2625 is a splendid one to behold
Re: Need a Code for Solenoid to Shift

Language as in, does your team use C++, Java, LabVIEW?
__________________
Head Programmer / Driver
  #5   Spotlight this post!  
Unread 29-10-2014, 00:13
Emiko Emiko is offline
Registered User
None #2439
 
Join Date: Aug 2013
Rookie Year: 2013
Location: Hawaii
Posts: 5
Emiko is on a distinguished road
Re: Need a Code for Solenoid to Shift

Thanks for clarifying. I didn't know, haha.
  #6   Spotlight this post!  
Unread 29-10-2014, 10:14
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,078
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: Need a Code for Solenoid to Shift

Assuming you have a double-acting solenoid, you want to use the DoubleSolenoid class. DoubleSolenoid.set() is the method that shifts the solenoid.
__________________
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)

  #7   Spotlight this post!  
Unread 29-10-2014, 14:16
Secretspy97 Secretspy97 is offline
Registered User
FRC #1126
Team Role: Programmer
 
Join Date: Oct 2011
Rookie Year: 2009
Location: New York
Posts: 25
Secretspy97 is an unknown quantity at this point
Re: Need a Code for Solenoid to Shift

The code below allows a joystick on port 1, to extend/retract a solenoid on port 1 by pushing button 1. It also adds a simple debump statement which makes the solenoid change state only when the button is first press.

<CODE>

//Instance Variables
public Solenoid shifter;
public Joystick joy;

//IN CONSTRUCTOR
shifter = new Solenoid(1);//1 is the port number
joy = new Joystick(1);


//IN TELEOP METHOD
boolean firstPress = true;
boolean inHighGear = false;

while(true){
if(joy.getRawButton(1) && firstPress){//first button
inHighGear = !inHighGear;
firstPress = false;
}else if(!joy.getRawButton(1)){
firstPress = true;
}
shifter.set(inHighGear);
}

</CODE>

Hope this helps!!
__________________
WHAT TIME IS IT?
1126
  #8   Spotlight this post!  
Unread 26-10-2014, 18:01
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,078
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: Need a Code for Solenoid to Shift

Quote:
Originally Posted by Emiko View Post
English.
Sorry, what programming language? Java, C++, or LabView.
__________________
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)

  #9   Spotlight this post!  
Unread 29-10-2014, 00:12
Emiko Emiko is offline
Registered User
None #2439
 
Join Date: Aug 2013
Rookie Year: 2013
Location: Hawaii
Posts: 5
Emiko is on a distinguished road
Re: Need a Code for Solenoid to Shift

Sorry, haha. It's Java.
  #10   Spotlight this post!  
Unread 26-10-2014, 18:04
EricH's Avatar
EricH EricH is offline
New year, new team
FRC #1197 (Torbots)
Team Role: Engineer
 
Join Date: Jan 2005
Rookie Year: 2003
Location: SoCal
Posts: 19,789
EricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond reputeEricH has a reputation beyond repute
Re: Need a Code for Solenoid to Shift

Quote:
Originally Posted by Emiko View Post
English.
What happened to the last person to answer that question that way:
http://www.chiefdelphi.com/forums/sh...118#post907118


And it includes a Labview example.
__________________
Past teams:
2003-2007: FRC0330 BeachBots
2008: FRC1135 Shmoebotics
2012: FRC4046 Schroedinger's Dragons

"Rockets are tricky..."--Elon Musk

Closed Thread


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 02:42.

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