VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex_colorsensor.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* */
3/* Copyright (c) Innovation First 2017, All rights reserved. */
4/* */
5/* Module: vex_colorsensor.h */
6/* Author: James Pearman */
7/* Created: 7 July 2017 */
8/* */
9/* Revisions: */
10/* V1.00 TBD - Initial release */
11/* */
12/*----------------------------------------------------------------------------*/
13
14#ifndef VEX_COLOR_CLASS_H
15#define VEX_COLOR_CLASS_H
16
17/*-----------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22/*-----------------------------------------------------------------------------*/
24/*-----------------------------------------------------------------------------*/
25namespace vex {
26 class colorsensor : public device {
27
28 public:
33 colorsensor( int32_t index );
35
36 bool installed();
37
42 int32_t value();
43
48 colorType colorname3();
49
50 colorType colorname12();
51
56 colorType colorname() {
57 return colorname12();
58 }
59
64 int32_t hue();
65
70 int32_t brightness( bool bRaw = false );
71
77
82 bool detects( colorType color );
83
88 void objectDetected( void (* callback)(void) );
89
93 void setLight( ledState state );
94 void setLight( int32_t intensity, percentUnits units = percentUnits::pct );
95
96 private:
97 enum class tEventType {
98 EVENT_OBJECT = 1,
99 };
100
101 uint8_t _eventId_1;
102 uint8_t _lastrgb;
103 uint8_t _lasthue;
104 void pollColors( void );
105 };
106};
107
108#endif // VEX_COLOR_CLASS_H
bool isNearObject()
Check to see if an object is detected by the color sensor.
colorsensor(int32_t index)
Creates a new color sensor object on the port specified in the parameter.
colorType colorname3()
Gets the name of the detected color.
colorType colorname()
Gets the name of the detected color.
int32_t brightness(bool bRaw=false)
Gets the brightness value detected by the color sensor.
int32_t value()
Gets the value of the color sensor.
void setLight(ledState state)
Turns the led on the color sensor on or off.
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.
int32_t hue()
Gets the hue detected by the color sensor.
Bumper switch device class
Definition vex_brain.h:24