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

Use this class when programming with a digital-in device. More...

#include <vex_triport.h>

Inheritance diagram for vex::digital_in:
vex::__tridevice

Public Member Functions

 digital_in (triport::port &port)
 Creates a new digital-in object on the port specified in the parameter. More...
 
int32_t value ()
 Gets the value of the digital-in device. More...
 
void high (void(*callback)(void))
 Calls a function when the digital input goes high. More...
 
void low (void(*callback)(void))
 Calls a function when the digital input goes low. More...
 
 operator int ()
 
 operator bool ()
 

Public Attributes

mevent & HIGH = _LOW
 
mevent & LOW = _HIGH
 

Detailed Description

Use this class when programming with a digital-in device.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ digital_in()

vex::digital_in::digital_in ( triport::port port)

Creates a new digital-in object on the port specified in the parameter.

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

Parameters
portA reference to a three wire port.

Member Function Documentation

◆ high()

void vex::digital_in::high ( void(*)(void)  callback)

Calls a function when the digital input goes high.

@prog_lang{pro} @drawer_cat{sensing} @block_sig{DigitalIn.high(pressedFunction);}

Parameters
callbackA reference to a function.

◆ low()

void vex::digital_in::low ( void(*)(void)  callback)

Calls a function when the digital input goes low.

@prog_lang{pro} @drawer_cat{sensing} @block_sig{DigitalIn.low(releasedFunction);}

Parameters
callbackA reference to a function.

◆ value()

int32_t vex::digital_in::value ( )

Gets the value of the digital-in device.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{DigitalIn.value()}

Returns
Returns an integer that represents the value of the digital-in device.

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