LightLib
PROS library for VEX V5: EKF/MCL localization, RAMSETE path following, high-level chassis API
Loading...
Searching...
No Matches
light::Piston Class Reference

Stateful 3-wire pneumatic piston with toggle helpers. More...

#include <piston.hpp>

Public Member Functions

 Piston (int input_port, bool default_state=false)
 Piston constructor.
 
 Piston (int input_port, int expander_smart_port, bool default_state=false)
 Piston constructor in 3 wire expander.
 
void set (bool input)
 Sets the piston to the input.
 
bool get ()
 Returns current piston state.
 
void button_toggle (int toggle)
 One button toggle for the piston.
 
void buttons (int active, int deactive)
 Two-button trigger: one button extends, the other retracts.
 

Public Attributes

pros::adi::DigitalOut piston
 Underlying PROS digital output.
 

Detailed Description

Stateful 3-wire pneumatic piston with toggle helpers.

Wraps a pros::adi::DigitalOut and remembers whether the piston is currently extended. Use button_toggle() for one-button toggling or buttons() for two-button extend/retract.

Definition at line 26 of file piston.hpp.

Constructor & Destructor Documentation

◆ Piston() [1/2]

light::Piston::Piston ( int  input_port,
bool  default_state = false 
)

Piston constructor.

The starting position of your piston defaults to false.

Parameters
input_portthe ports of your pistons
default_statestarting state of your piston

◆ Piston() [2/2]

light::Piston::Piston ( int  input_port,
int  expander_smart_port,
bool  default_state = false 
)

Piston constructor in 3 wire expander.

The starting position of your piston defaults to false.

Parameters
input_portsthe ports of your pistons
default_statestarting state of your piston

Member Function Documentation

◆ button_toggle()

void light::Piston::button_toggle ( int  toggle)

One button toggle for the piston.

Parameters
togglean input button

◆ buttons()

void light::Piston::buttons ( int  active,
int  deactive 
)

Two-button trigger: one button extends, the other retracts.

Parameters
activebutton id that sets the piston to true
deactivebutton id that sets the piston to false

◆ get()

bool light::Piston::get ( )

Returns current piston state.

◆ set()

void light::Piston::set ( bool  input)

Sets the piston to the input.

Parameters
inputtrue sets to the opposite of the starting position

Member Data Documentation

◆ piston

pros::adi::DigitalOut light::Piston::piston

Underlying PROS digital output.

Exposed for advanced use.

Definition at line 29 of file piston.hpp.


The documentation for this class was generated from the following file: