View Single Post
  #6   Spotlight this post!  
Unread 16-01-2014, 16:44
feverittm's Avatar
feverittm feverittm is offline
Registered User
FRC #0997 (Spartans)
Team Role: Mentor
 
Join Date: Apr 2010
Rookie Year: 2010
Location: Corvallis, OR
Posts: 121
feverittm will become famous soon enoughfeverittm will become famous soon enough
Re: Pnuematics Programming Issues

Quote:
Originally Posted by captianjroot View Post
Code:
//this is all within our main robot class
    
    Compressor compress;
    

    public void robotInit(){

        compress=new Compressor(1,1);

    }

    public void operatorControl() {
        while(isOperatorControl()&&isEnabled()){
            

            if(!compress.enabled())
            {
                compress.start();
            }

            
        }
    }
This is of course assuming that the compressor is connected to a spike that is connected to relay channel 1 (on the first digital sidecar if you have more than one) and that the pressure switch is connected to digital input #1 on the same digital sidecar. Also note that you don't really need the 'enabled' clause, you can continually 'start' the compressor. It doesn't hurt anything.
This will only start the compressor in teleop.
__________________
Floyd Moore
Mentor Electrical and Pneumatics
Team 997 - Spartan Robotics
Corvallis High School, Corvallis Oregon