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

Use this class when programming with the limit switch. More...

#include <vex_triport.h>

Inheritance diagram for vex::limit:
vex::__tridevice

Public Member Functions

 limit (triport::port &port)
 Creates a new limit object on the port specified in the parameter. More...
 
int32_t value ()
 Gets the value of the limit switch. More...
 
int32_t pressing ()
 Gets the state of the limit device. More...
 
void pressed (void(*callback)(void))
 Calls a function when the limit switch is pressed. More...
 
void released (void(*callback)(void))
 Calls a function when the limit 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 limit switch.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ limit()

vex::limit::limit ( triport::port port)

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

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

Parameters
portA reference to a three wire port.

Member Function Documentation

◆ pressed()

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

Calls a function when the limit switch is pressed.

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

Parameters
callbackA reference to a function.

◆ pressing()

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

Gets the state of the limit device.

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

Returns
Returns the state of the limit device.

◆ released()

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

Calls a function when the limit switch is released.

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

Parameters
callbackA reference to a function.

◆ value()

int32_t vex::limit::value ( )

Gets the value of the limit switch.

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

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

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