VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex_touchled.h
Go to the documentation of this file.
1/*----------------------------------------------------------------------------*/
2/* */
3/* Copyright (c) Innovation First 2017, All rights reserved. */
4/* */
5/* Module: vex_touchled.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_LED_CLASS_H
15#define VEX_LED_CLASS_H
16
17/*-----------------------------------------------------------------------------*/
20/*---------------------------------------------------------------------------*/
21
22/*-----------------------------------------------------------------------------*/
24/*-----------------------------------------------------------------------------*/
25namespace vex {
26 class touchled : public device {
27
28 public:
33 touchled( int32_t index );
34 ~touchled();
35
36 bool installed();
37
42 int32_t value();
43
49 void on( colorType color, uint32_t brightness = 100 );
50
56 void on( uint32_t hue, uint32_t brightness = 100 );
57
65 void on( uint8_t red, uint8_t green, uint8_t blue, uint32_t brightness = 100 );
66
70 void off( void );
71
72
73 void setColor( colorType color );
74
79 void setFade( fadeType setting );
80
85 void setBrightness( uint32_t brightness );
86
93 void setBlink( colorType color, double onTime = 0.25, double offTime = 0.25 );
94
101 void setBlink( uint32_t hue, double onTime = 0.25, double offTime = 0.25 );
102
107 bool pressing();
108
113 void pressed( void (* callback)(void) );
114
119 void released( void (* callback)(void) );
120
121 private:
122 uint8_t _eventId_1;
123 uint8_t _eventId_2;
124 uint8_t _red;
125 uint8_t _green;
126 uint8_t _blue;
127 uint8_t _brightness;
128
129 ledState _state;
130
131 enum class tEventType {
132 EVENT_PRESSED = 1,
133 EVENT_RELEASED = 2
134 };
135
136 void _setBrightness( uint32_t brightness );
137 void _setColor( uint32_t rgb );
138 void _setBlink( double onTime, double offTime );
139 uint32_t _colorToRgb( colorType color );
140 uint32_t _hueToRgb( uint32_t hue );
141 };
142};
143
144#endif // VEX_LED_CLASS_H
void setFade(fadeType setting)
Sets the default fade time for the touchled sensor.
void on(uint32_t hue, uint32_t brightness=100)
Turn on the led in the touchled sensor.
void setBlink(uint32_t hue, double onTime=0.25, double offTime=0.25)
Set the led in the touchled sensor as blinking.
void on(uint8_t red, uint8_t green, uint8_t blue, uint32_t brightness=100)
Turn on the led in the touchled sensor.
touchled(int32_t index)
Creates a new touchled sensor object on the port specified in the parameter.
void released(void(*callback)(void))
Calls a function when the touchled is released.
bool pressing()
Get the pressed status of the touchled device.
void setBrightness(uint32_t brightness)
Turn on the led in the touchled sensor, or change current brightness.
void on(colorType color, uint32_t brightness=100)
Turn on the led in the touchled sensor.
void setBlink(colorType color, double onTime=0.25, double offTime=0.25)
Set the led in the touchled sensor as blinking.
void pressed(void(*callback)(void))
Calls a function when the touchled is pressed.
void off(void)
Turn off the led in the touchled sensor.
int32_t value()
Gets the value of the touchled sensor.
Bumper switch device class
Definition vex_brain.h:24