VEXcode Doxygen
Public Member Functions | Public Attributes | List of all members
vex::bumper Class Reference

Use this class when programming with the bumper device. More...

#include <vex_triport.h>

Inheritance diagram for vex::bumper:
vex::__tridevice

Public Member Functions

 bumper (triport::port &port)
 Creates a new bumper object on the port specified in the parameter. More...
 
int32_t value ()
 Gets the value of the bumper device. More...
 
int32_t pressing ()
 Get the pressed status of the bumper device. More...
 
void pressed (void(*callback)(void))
 Calls a function when the bumper switch is pressed. More...
 
void released (void(*callback)(void))
 Calls a function when the bumper switch is released. More...
 
 operator int ()
 
 operator bool ()
 

Public Attributes

mevent & PRESSED = _PRESSED
 
mevent & RELEASED = _RELEASED
 

Detailed Description

Use this class when programming with the bumper device.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ bumper()

vex::bumper::bumper ( triport::port port)

Creates a new bumper object on the port specified in the parameter.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::bumper Bumper = vex::bumper(Brain.ThreeWirePort.A);}

Parameters
portA reference to a three wire port.

Member Function Documentation

◆ pressed()

void vex::bumper::pressed ( void(*)(void)  callback)

Calls a function when the bumper switch is pressed.

@prog_lang{pro} @drawer_cat{sensing} @block_sig{Bumper.pressed(pressedFunction);}

Parameters
callbackA reference to a function.

◆ pressing()

int32_t vex::bumper::pressing ( void  )
inline

Get the pressed status of the bumper device.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Bumper.pressing()} @return_type_override{bool}

Returns
Returns the state of the bumper device. If it is pressed it will return a one. If unpressed, it will return a zero.

◆ released()

void vex::bumper::released ( void(*)(void)  callback)

Calls a function when the bumper switch is released.

@prog_lang{pro} @drawer_cat{sensing} @block_sig{Bumper.released(releasedFunction);}

Parameters
callbackA reference to a function.

◆ value()

int32_t vex::bumper::value ( )

Gets the value of the bumper device.

@prog_lang{none} @drawer_cat{none} @block_sig{Bumper.value()}

Returns
Returns an integer that represents the value of the bumper device.

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