14#ifndef VEX_OPTICAL_CLASS_H
15#define VEX_OPTICAL_CLASS_H
28 int32_t _led_intensity;
29 int32_t _prox_threshold;
32 enum class tEventType {
33 EVENT_OBJECT_FOUND = 0,
34 EVENT_OBJECT_LOST = 1,
36 EVENT_GESTURE_DOWN = 3,
37 EVENT_GESTURE_LEFT = 4,
38 EVENT_GESTURE_RIGHT = 5,
47 optical( int32_t index,
bool enableGesture =
false );
134 void setLightPower( int32_t intensity, percentUnits units = percentUnits::pct );
154 const uint8_t & udata = _udata;
155 const uint8_t & ddata = _ddata;
156 const uint8_t & ldata = _ldata;
157 const uint8_t & rdata = _rdata;
158 const uint32_t & count = _count;
190 rgbc() : red(0), green(0), blue(0), clear(0) {}
A class to collect all gesture detection data.
A class to hold raw or processed rgbc data.
Use the optical class to control the optical sensor.
bool isNearObject()
Check to see if an object is detected by the optical sensor.
double brightness(bool bRaw=false)
Gets the brightness value detected by the optical sensor.
int32_t objectDetectThreshold(int32_t value=0)
sets the value of the detection threshold
void objectDetected(void(*callback)(void))
Calls a function when the optical sensor proximity sensor detects an object.
void gestureUp(void(*callback)(void))
Calls a function when the optical sensor gesture engine detects a movement down to up.
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.
double hue()
Gets the hue detected by the optical sensor.
optical(int32_t index, bool enableGesture=false)
Creates a new optical sensor object on the port specified.
void gestureEnable(void)
Enable gesture detection on the optical sensor.
vex::colorType colorname()
Gets the detected color as a fully saturated vex::color.
void gestureDisable(void)
Disable gesture detection on the optical sensor.
void setLightPower(int32_t intensity, percentUnits units=percentUnits::pct)
Set the intensity of the led on the optical sensor in percent.
void gestureDown(void(*callback)(void))
Calls a function when the optical sensor gesture engine detects a movement up to down.
void integrationTime(double timeMs)
set sensor integration time
optical::rgbc getRgb(bool bRawColor=true)
get raw or processed rgbc data. The default is raw.
double integrationTime()
get sensor integration time
optical::gesture getGesture()
get object with the most recent gesture detection data.
void objectLost(void(*callback)(void))
Calls a function when the optical sensor proximity sensor detects an object is missing.
Bumper switch device class
gestureType
The defined units for optical sensor gesture types.