Go to Post FIRST is more than FRC. - gblake [more]
Home
Go Back   Chief Delphi > Technical > Pneumatics
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 23-02-2016, 00:05
Noviv's Avatar
Noviv Noviv is offline
Registered User
FRC #1477 (Texas Torque)
Team Role: Programmer
 
Join Date: Jun 2015
Rookie Year: 2013
Location: Texas
Posts: 5
Noviv is an unknown quantity at this point
Re: Help programming pneumatics

You will just need to set the value of the pneumatic to one position while the button is being pressed, and the other when it is not.

Psuedocode:
Code:
if (A button is pressed) {
    pneumatic.set(on);
} else {
    pneumatic.set(off);
}
Java Single Solenoid:
Code:
Solenoid solenoid = new Solenoid(port);
if (operator.getRawButton(1)) {//example
    solenoid.set(true);
} else {
    solenoid.set(false);
}
Java Single Solenoid:
Code:
DoubleSolenoid solenoid = new DoubleSolenoid(portA, portB);
if (operator.getRawButton(1)) {
    solenoid.set(DoubleSolenoid.Value.kForward);
} else {
    solenoid.set(DoubleSolenoid.Value.kReverse);
}
getRawButton(1) should be mapped to the A button on Xbox controllers. Switch it to getRawButton(2) for Logitech controllers.
 


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


All times are GMT -5. The time now is 12:25.

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