![]() |
VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
|
Use the optical class to control the optical sensor. More...
#include <vex_optical.h>
Classes | |
class | gesture |
A class to collect all gesture detection data. More... | |
class | rgbc |
A class to hold raw or processed rgbc data. More... | |
Public Member Functions | |
optical (int32_t index, bool enableGesture=false) | |
Creates a new optical sensor object on the port specified. | |
bool | installed () |
int32_t | value () |
double | hue () |
Gets the hue detected by the optical sensor. | |
double | brightness (bool bRaw=false) |
Gets the brightness value detected by the optical sensor. | |
vex::colorType | colorname () |
Gets the detected color as a fully saturated vex::color. | |
bool | isNearObject () |
Check to see if an object is detected by the optical sensor. | |
void | objectDetected (void(*callback)(void)) |
Calls a function when the optical sensor proximity sensor detects an object. | |
void | objectLost (void(*callback)(void)) |
Calls a function when the optical sensor proximity sensor detects an object is missing. | |
int32_t | objectDetectThreshold (int32_t value=0) |
sets the value of the detection threshold | |
void | gestureUp (void(*callback)(void)) |
Calls a function when the optical sensor gesture engine detects a movement down to up. | |
void | gestureDown (void(*callback)(void)) |
Calls a function when the optical sensor gesture engine detects a movement up to down. | |
void | gestureLeft (void(*callback)(void)) |
Calls a function when the optical sensor gesture engine detects a movement right to left. | |
void | gestureRight (void(*callback)(void)) |
Calls a function when the optical sensor gesture engine detects a movement left to right. | |
void | setLight (ledState state) |
Turns the led on the optical sensor on or off. | |
void | setLightPower (int32_t intensity, percentUnits units=percentUnits::pct) |
Set the intensity of the led on the optical sensor in percent. | |
void | gestureEnable (void) |
Enable gesture detection on the optical sensor. | |
void | gestureDisable (void) |
Disable gesture detection on the optical sensor. | |
optical::gesture | getGesture () |
get object with the most recent gesture detection data. | |
optical::rgbc | getRgb (bool bRawColor=true) |
get raw or processed rgbc data. The default is raw. | |
void | integrationTime (double timeMs) |
set sensor integration time | |
double | integrationTime () |
get sensor integration time | |
![]() | |
device (int32_t index) | |
IQ_DeviceType | type () |
int32_t | index () |
void | init (int32_t index) |
int32_t | readDigitalPin () |
int32_t | readAnalogPin () |
Additional Inherited Members | |
![]() | |
void | setPollInterval (int32_t value) |
bool | pollValid (bool bSave) |
![]() | |
int16_t | _index |
Use the optical class to control the optical sensor.
Definition at line 26 of file vex_optical.h.
vex::optical::optical | ( | int32_t | index, |
bool | enableGesture = false ) |
Creates a new optical sensor object on the port specified.
index | The port index for this sensor. The index is zero-based. |
enableGesture | enable gesture detection |
double vex::optical::brightness | ( | bool | bRaw = false | ) |
Gets the brightness value detected by the optical sensor.
vex::colorType vex::optical::colorname | ( | ) |
Gets the detected color as a fully saturated vex::color.
Gets the detected color as a colorType
void vex::optical::gestureDown | ( | void(* | callback )(void) | ) |
Calls a function when the optical sensor gesture engine detects a movement up to down.
callback | A reference to a function. |
void vex::optical::gestureLeft | ( | void(* | callback )(void) | ) |
Calls a function when the optical sensor gesture engine detects a movement right to left.
callback | A reference to a function. |
void vex::optical::gestureRight | ( | void(* | callback )(void) | ) |
Calls a function when the optical sensor gesture engine detects a movement left to right.
callback | A reference to a function. |
void vex::optical::gestureUp | ( | void(* | callback )(void) | ) |
Calls a function when the optical sensor gesture engine detects a movement down to up.
callback | A reference to a function. |
double vex::optical::hue | ( | ) |
Gets the hue detected by the optical sensor.
|
virtual |
Reimplemented from vex::device.
bool vex::optical::isNearObject | ( | ) |
Check to see if an object is detected by the optical sensor.
void vex::optical::objectDetected | ( | void(* | callback )(void) | ) |
Calls a function when the optical sensor proximity sensor detects an object.
callback | A reference to a function. |
int32_t vex::optical::objectDetectThreshold | ( | int32_t | value = 0 | ) |
sets the value of the detection threshold
value | The new detection threshold in proximity units (1 to 255). 0 means no change. |
void vex::optical::objectLost | ( | void(* | callback )(void) | ) |
Calls a function when the optical sensor proximity sensor detects an object is missing.
callback | A reference to a function. |
|
virtual |
Reimplemented from vex::device.