Pneumatic#

Introduction#

The Pneumatics system uses an air pump and solenoid to control compressed air for moving cylinders. It can turn the pump on or off and extend or retract cylinders through code.

For the examples below, the configured Pneumatics system will be named Pneumatics1, and will be used in all subsequent examples throughout this API documentation when referring to Pneumatic class methods.

Below is a list of available methods:

Actions – Compress or decompress air with an air pump.

  • extend – Extend a cylinder.

  • retract – Retract a cylinder.

  • pumpOn – Turn on the air pump.

  • pumpOff – Turn off the air pump.

  • pump – Set the on or off state of the air pump.

Getters – Check if the solenoid is connected.

  • installed – Returns whether or not a solenoid is connected to the Brain.

Constructors – Manually initialize and configure Pneumatics.

Actions#

extend#

extend extends a cylinder.

Usage:
Pneumatic1.extend(id);

Parameters

Description

id

The cylinder to extend:

  • cylinder1
  • cylinder2
  • cylinderALL – Both cylinders
// Example coming soon

retract#

retract retracts a cylinder.

Usage:
Pneumatic1.retract(id);

Parameters

Description

id

The cylinder to extend:

  • cylinder1
  • cylinder2
  • cylinderALL – Both cylinders
// Example coming soon

pumpOn#

pumpOn turns the air pump on.

Usage:
Pneumatic1.pumpOn();

Parameters

Description

This method has no parameters.

// Example coming soon

pumpOff#

pumpOff turns the air pump off.

Usage:
Pneumatic1.pumpOff();

Parameters

Description

This method has no parameters.

// Example coming soon

pump#

pump turns the air pump on or off.

Usage:
Pneumatic1.pump(state);

Parameters

Description

state

The air pump state:

  • true – Turn the air pump on.
  • false – Turn the air pump off.
// Example coming soon

Getters#

installed#

installed returns a Boolean indicating whether the solenoid is connected to the Brain.

  • 1 - The solenoid is connected to the Brain.

  • 0 - The solenoid is not connected to the Brain.

Usage:
Pneumatic1.installed()

Parameters

Description

This method has no parameters.

// Example coming soon

Constructors#

pneumatic#

pneumatic creates an object of the pneumatic Class in the specified port.

Default Usage:
pneumatic Pneumatic1 = pneumatic(port);

Overload Usages:
pneumatic Pneumatic1 = pneumatic(port, bPumpEnable);

Parameter

Description

port

Which Smart Port that the Pneumatic Solenoid is connected to as PORT followed by the port number, ranging from 1 to 12.

bPumpEnable

A Boolean representing whether to enable or disable the air pump:

  • true – The air pump is set to on at the start of a project.
  • false – The air pump is set to off at the start of the project.
    // Example coming soon