VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex::colorsensor Class Reference
Inheritance diagram for vex::colorsensor:
vex::device

Public Member Functions

 colorsensor (int32_t index)
 Creates a new color sensor object on the port specified in the parameter.
 
bool installed ()
 
int32_t value ()
 Gets the value of the color sensor.
 
colorType colorname3 ()
 Gets the name of the detected color.
 
colorType colorname12 ()
 
colorType colorname ()
 Gets the name of the detected color.
 
int32_t hue ()
 Gets the hue detected by the color sensor.
 
int32_t brightness (bool bRaw=false)
 Gets the brightness value detected by the color sensor.
 
bool isNearObject ()
 Check to see if an object is detected by the color sensor.
 
bool detects (colorType color)
 Check to see if the color sensor is detecting a color.
 
void objectDetected (void(*callback)(void))
 Calls a function when the color sensor proximity sensor detects an object.
 
void setLight (ledState state)
 Turns the led on the color sensor on or off.
 
void setLight (int32_t intensity, percentUnits units=percentUnits::pct)
 
- Public Member Functions inherited from vex::device
 device (int32_t index)
 
IQ_DeviceType type ()
 
int32_t index ()
 
void init (int32_t index)
 
int32_t readDigitalPin ()
 
int32_t readAnalogPin ()
 

Additional Inherited Members

- Protected Member Functions inherited from vex::device
void setPollInterval (int32_t value)
 
bool pollValid (bool bSave)
 
- Protected Attributes inherited from vex::device
int16_t _index
 

Detailed Description

Definition at line 26 of file vex_colorsensor.h.

Constructor & Destructor Documentation

◆ colorsensor()

vex::colorsensor::colorsensor ( int32_t index)

Creates a new color sensor object on the port specified in the parameter.

Parameters
portindex to the brain port.

Member Function Documentation

◆ brightness()

int32_t vex::colorsensor::brightness ( bool bRaw = false)

Gets the brightness value detected by the color sensor.

Returns
Returns an integer that represents the brightness value the color sensor has detected.

◆ colorname()

colorType vex::colorsensor::colorname ( )
inline

Gets the name of the detected color.

Returns
Returns a colorType that represents the name of the closest color detected to twelve possible value.

Definition at line 56 of file vex_colorsensor.h.

◆ colorname3()

colorType vex::colorsensor::colorname3 ( )

Gets the name of the detected color.

Returns
Returns a colorType that represents the name of the closest color detected to red, green or blue.

◆ detects()

bool vex::colorsensor::detects ( colorType color)

Check to see if the color sensor is detecting a color.

Returns
Returns a boolean that represents whether the color has been detected.

◆ hue()

int32_t vex::colorsensor::hue ( )

Gets the hue detected by the color sensor.

Returns
Returns an integer that represents the hue the color sensor has detected.

◆ installed()

bool vex::colorsensor::installed ( )
virtual

Reimplemented from vex::device.

◆ isNearObject()

bool vex::colorsensor::isNearObject ( )

Check to see if an object is detected by the color sensor.

Returns
Returns a boolean that represents whether an object has been detected.

◆ objectDetected()

void vex::colorsensor::objectDetected ( void(* callback )(void))

Calls a function when the color sensor proximity sensor detects an object.

Parameters
callbackA reference to a function.

◆ value()

int32_t vex::colorsensor::value ( )
virtual

Gets the value of the color sensor.

Returns
Returns an integer that represents the hue the color sensor has detected.

Reimplemented from vex::device.


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