Go to Post This 6 weeks of work, sweat, thinking, designing, building, talking, discussing, turning wrenches, wiring, programming, drawing on chalk boards, eating pizza, drinking mountain dew, with the students - is what the FIRST experience is really about. - meaubry [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 20-02-2010, 17:18
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
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
Reply With Quote
  #2   Spotlight this post!  
Unread 20-02-2010, 17:25
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: solenoid problems

How can I implement that into my code.
Reply With Quote
  #3   Spotlight this post!  
Unread 20-02-2010, 22:34
KayyPii's Avatar
KayyPii KayyPii is offline
Registered User
FRC #1404 (SHOCKs)
Team Role: Programmer
 
Join Date: Oct 2008
Rookie Year: 2007
Location: Toronto
Posts: 45
KayyPii will become famous soon enough
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.
__________________
=>"That hole you drilled is a little off."
=>"Don't panic, just make it bigger and put a washer on it!"

=>Eye ball once, and cut as many times as it takes

Reply With Quote
  #4   Spotlight this post!  
Unread 21-02-2010, 14:14
Twisted eric's Avatar
Twisted eric Twisted eric is offline
Registered User
FRC #0581
 
Join Date: Jan 2010
Location: San Jose
Posts: 54
Twisted eric is an unknown quantity at this point
Re: solenoid problems

Quote:
Originally Posted by KayyPii View Post
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.
Can you please show me an example this is my first year programming in Java and I have no mentor to help.
Reply With Quote
  #5   Spotlight this post!  
Unread 21-02-2010, 22:08
KayyPii's Avatar
KayyPii KayyPii is offline
Registered User
FRC #1404 (SHOCKs)
Team Role: Programmer
 
Join Date: Oct 2008
Rookie Year: 2007
Location: Toronto
Posts: 45
KayyPii will become famous soon enough
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
That is pretty much our code for our kicker with the few changes to the variable names. Also, I believe that when you initialize the solenoid to channel 1, it is the first channel on the breakout board. I think its labelled as 0. Hope this helps
__________________
=>"That hole you drilled is a little off."
=>"Don't panic, just make it bigger and put a washer on it!"

=>Eye ball once, and cut as many times as it takes

Reply With Quote
  #6   Spotlight this post!  
Unread 20-02-2010, 17:58
nikRbokRz nikRbokRz is offline
Registered User
FRC #1683
 
Join Date: Jan 2010
Location: Atlanta, GA
Posts: 14
nikRbokRz is an unknown quantity at this point
Re: solenoid problems

Quote:
Originally Posted by Twisted eric View Post
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.
First of all, instead of doing "edu.wpi.first.wpilibj.Relay.value.kOn", isn't it much easier to just to "Relay.value.kOn"?

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;
Depending on how you've connected your solenoid(s), you will have to set them true or false to get it to work as you wish.

Hope that helped.
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

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


All times are GMT -5. The time now is 09:26.

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