pneumatic#
Initializing the pneumatic Class#
A Pneumatic System is created by using the following constructor:
The pneumatic
constructor creates a pneumatic object in the specified Port.
Parameter |
Description |
---|---|
|
A valid Smart Port that the Pneumatic Solenoid is connected to. |
|
A boolean value representing whether to enable or disable the air pump. |
// Construct a Pneumatic System "Pneumatic" with the
// pneumatic class.
pneumatic Pnuematic = pneumatic(PORT1);
This Pneumatic
object will be used in all subsequent examples throughout this API documentation when referring to pneumatic class methods.
Class Methods#
extend()#
The extend(value)
method extends a cylinder.
Parameters |
Description |
---|---|
value |
A valid CylinderType. |
Returns: None.
// Extend the first cylinder.
Pneumatic.extend(cylinder1);
// Wait 2 seconds.
wait(2, seconds);
// Retract the first cylinder.
Pneumatic.retract(cylinder1);
retract()#
The retract(value)
method retracts a cylinder.
Parameters |
Description |
---|---|
value |
A valid CylinderType. |
Returns: None.
// Extend the first cylinder.
Pneumatic.extend(cylinder1);
// Wait 2 seconds.
wait(2, seconds);
// Retract the first cylinder.
Pneumatic.retract(cylinder1);
pumpOn()#
The pumpOn()
method turns the pneumatic air pump on.
Returns: None.
// Turn air pump on.
Pneumatic.pumpOn();
pumpOff()#
The pumpOff()
method turns the pneumatic air pump off.
Returns: None.
// Turn air pump off.
Pneumatic.pumpOff();
pump()#
The pump(state)
method turns the pneumatic air pump on or off.
Parameters |
Description |
---|---|
state |
The compressor state. |
Returns: None.
// Turn air pump on.
Pneumatic.pump(true);
wait(3, seconds);
// Turn air pump off.
Pneumatic.pump(false);
installed()#
The installed()
method checks for device connection.
Returns: true
if the device is connected. false
if it is not.