|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: solenoid problems
if (fluffy.getPressureSwitchValue()) {
fluffy.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOff); } else { fluffy.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOn); } this will i believe to turn off the compressor (have not yet tried it yet) also is the only import we need is import edu.wpi.first.wpilibj.solenoid; right thanks. Last edited by Twisted eric : 20-02-2010 at 17:20. Reason: revision |
|
#2
|
||||
|
||||
|
Re: solenoid problems
How can I implement that into my code.
|
|
#3
|
||||
|
||||
|
Re: solenoid problems
After you import the solenoid class, you will have to create your solenoid objects in Java. You can do this using :
Solenoid kicker = new Solenoid ( slot, channel ); then in your program, you can check the status of the trigger using an "if" selection and use the set( boolean on ); method to turn the solenoid on. |
|
#4
|
||||
|
||||
|
Re: solenoid problems
Quote:
|
|
#5
|
||||
|
||||
|
Re: solenoid problems
Code:
Solenoid kicker = new Solenoid ( 7, 1 ); //locate a solenoid on slot 7 of cRio and channel 1 on the solenoid breakout.
if ( pup.getButton( Joystick.ButtonType.kTrigger ) == true ) //if the switch is pressed
kicker.set(true); //turn on the solenoid
else
kicker.set(false); //turn off the solenoid
![]() |
|
#6
|
|||
|
|||
|
Re: solenoid problems
Quote:
From what my team assumed, the compressor automatically turns on/off, depending on the pressure switch. We initially couldn't get it to work, but it turned out to just be a bad spike. So I'm not really sure if you need to be turning it on/off. As for the solenoid, yes all you need to import is Code:
import edu.wpi.first.spilibj.Solenoid; Hope that helped. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Solenoid actuation problems | Alexandstein | Pneumatics | 4 | 17-02-2010 21:39 |
| Solenoid not firing off Solenoid Breakout | spooncwru | Pneumatics | 2 | 30-01-2010 17:46 |
| single solenoid | seanl | Pneumatics | 4 | 18-02-2007 02:32 |
| Programming a Solenoid | Brigander | Pneumatics | 4 | 17-02-2007 14:06 |
| Labview problems and code problems | ajsetter | Programming | 25 | 18-01-2006 17:07 |