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

Use this class when programming with a light sensor. More...

#include <vex_triport.h>

Inheritance diagram for vex::light:
vex::__tridevice

Public Member Functions

 light (triport::port &port)
 Creates a new light object on the port specified in the parameter. More...
 
int32_t value (analogUnits units)
 Gets the value of the light sensor. More...
 
int32_t brightness (percentUnits units=percentUnits::pct)
 
int32_t value (percentUnits units)
 Gets the value of the light sensor. More...
 
void changed (void(*callback)(void))
 Calls a function when the light sensor value changes. More...
 

Public Attributes

mevent & CHANGED = _CHANGED
 

Detailed Description

Use this class when programming with a light sensor.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ light()

vex::light::light ( triport::port port)

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

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

Parameters
portA reference to a three wire port.

Member Function Documentation

◆ changed()

void vex::light::changed ( void(*)(void)  callback)

Calls a function when the light sensor value changes.

@prog_lang{pro} @drawer_cat{sensing} @block_sig{Light.changed(changedFunction);}

Parameters
callbackA reference to a function.

◆ value() [1/2]

int32_t vex::light::value ( analogUnits  units)

Gets the value of the light sensor.

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{Light.value(vex::analogUnits::range8bit)}

Returns
Returns an integer that represents the unit value specified by the parameter of the light sensor.
Parameters
unitsThe measurement unit for the light device.

◆ value() [2/2]

int32_t vex::light::value ( percentUnits  units)
inline

Gets the value of the light sensor.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Light.value(percent)} @cpp_sig{Light.value(vex::percentUnits::pct)}

Returns
Returns an integer that represents the unit value specified by the parameter of the light sensor.
Parameters
unitsThe measurement unit for the light device.

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