Go to Post The fact is, if people dont know about nature they do nothing to preserve it...nature is something to be valued and not feared or destroyed. - Wayne C. [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

 
 
 
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
Prev Previous Post   Next Post Next
  #8   Spotlight this post!  
Unread 07-02-2010, 01:22
MattD's Avatar
MattD MattD is offline
Registered User
AKA: Matthew Douglas
FRC #0228 (GUS Robotics)
Team Role: Alumni
 
Join Date: Feb 2006
Rookie Year: 2005
Location: Indianapolis, IN
Posts: 185
MattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to beholdMattD is a splendid one to behold
Send a message via AIM to MattD
Re: How to program solenoid and compressor?

Quote:
Originally Posted by Kingofl337 View Post
This is not correct, call the Compressor class tell it the digital input and the spike port and it will take care for you.

ex: Compressor myComp = new Compressor(1,1); //That's all you need
By default, the compressor is not enabled until you call the start() method on it. This is needed in addition to the creation of a Compressor object.

Quote:
Originally Posted by bamse View Post
Howdy...

We had to insert this piece of code in the operatorControl() as well,

// New compressor code...
if (airCompressor.getPressureSwitchValue()) {
airCompressor.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOff);
} else {
airCompressor.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOn);
}

And don't forget to turn the compressor off when exiting your operatorControl loop...

airCompressor.setRelayValue(edu.wpi.first.wpilibj. Relay.Value.kOff);
Make sure to call start() on the compressor object, and also make sure that it is a class member so it does not go out of scope. Since the example code in post #5 shows no declaration for airCompressor, my best guess is that you're creating a new one each loop.

The example should look more like this:
Code:
....
public class Airsystem extends SimpleRobot {
     private Joystick DriverStick;
     private AxisCamera camera;                       //defines Axis Camera
     private Solenoid s1,s2;                             //defines solenoids
     private Compressor airCompressor;

     public Airsystem() {
          DriverStick = new Joystick(1);             // USB port
          airCompressor = new Compressor(1,1);  //Digtial I/O,Relay
          airCompressor.start();                        // Start the air compressor

          s1 = new Solenoid(1);                        // Solenoid port
          s2 = new Solenoid(2);
     }
     ...
__________________
GUS Robotics Team 228

2010 WPI Engineering Inspiration Award
2010 WPI Regional Champions (Thanks 230 & 20!)
2010 CT VEX Champions
2010 CT VEX Innovate Award
2009 QCC VEX Champions
2009 CT Motorola Quality Award
2007 CT J&J Sportsmanship Award
2006 CT Best Website Award
Reply With Quote
 


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 Wiring and Compressor Help BurtGummer Electrical 16 17-02-2010 14:25
How do you download a program and have it saved to the c-rio 2560DawgDM NI LabVIEW 12 03-02-2010 20:58
How to download and keep a program on crio zackcool123 Programming 2 16-02-2009 18:22
How to conect solenoids to the circuit board. and how to program it...??? arpitshah Pneumatics 6 13-01-2008 15:06
Teach Genia How to Program and Win a Prize Eugenia Gabrielov Chit-Chat 25 25-02-2005 13:31


All times are GMT -5. The time now is 10: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