Thread: Java Pneumatics
View Single Post
  #2   Spotlight this post!  
Unread 02-15-2011, 09:11 PM
Patrickwhite's Avatar
Patrickwhite Patrickwhite is offline
May the North be with you
FRC #0610 (The Coyotes)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2008
Location: Toronto
Posts: 88
Patrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of lightPatrickwhite is a glorious beacon of light
Re: Java Pneumatics

For the Solenoids, the first thing to do is to create the Solenoid object. The constructor follows the general WPI format, with options to create it based on slot (of the Solenoid module) and channel, or just by channel.
Code:
Solenoid armSol = new Solenoid(7,4); //creates a Solenoid object in slot 7, channel 4.
After that, there are only two functions to concern yourself with: get(), which returns the current state of the Solenoid (true or false), and set(boolean on), which sets the state of the Solenoid.
Code:
armSol.set(true); //turns the Solenoid on
The compressor can take up to four parameters, because it has two 'things' to set: the location of the pressure switch (what reads the pressure and tells the robot when it's 'full'), and the location of the relay (what turns the compressor on or off). After that, start() the compressor object and it should automatically regulate itself, turning off when the pressure is high enough, then restarting when it drops. You can get the value of the pressure switch and the state of the compressor with getPressureSwitchValue() and enabled(), respectively, but for safety reasons you cannot control the actual state of the compressor manually.
Code:
Compressor aCompressor = new Compressor(1,1); //create a compressor with the default slots and relay and pressure switch channels 1 and 1.
aCompressor.start(); //start the compressor.
__________________
while(!going.isTough());
tough.exit();

What will we do tonight, Warfa?
The same thing we do every night, Patrick. Sit and wait for Electrical.

Last edited by Patrickwhite : 02-15-2011 at 09:20 PM. Reason: I may or may not have completely forgotten the compressor.
Reply With Quote