3
3
4
4
Demonstrates usage of onboard RGB LED on some ESP dev boards.
5
5
6
- Calling digitalWrite(LED_BUILTIN , HIGH) will use hidden RGB driver.
6
+ Calling digitalWrite(RGB_BUILTIN , HIGH) will use hidden RGB driver.
7
7
8
8
RGBLedWrite demonstrates controll of each channel:
9
9
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
10
10
11
11
WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin
12
12
with normal HIGH/LOW level
13
13
*/
14
- // #define LED_BRIGHTNESS 64 // Change white brightness (max 255)
14
+ // #define RGB_BRIGHTNESS 64 // Change white brightness (max 255)
15
15
16
16
// the setup function runs once when you press reset or power the board
17
17
@@ -21,19 +21,19 @@ void setup() {
21
21
22
22
// the loop function runs over and over again forever
23
23
void loop () {
24
- #ifdef BOARD_HAS_NEOPIXEL
25
- digitalWrite (LED_BUILTIN , HIGH); // Turn the RGB LED white
24
+ #ifdef RGB_BUILTIN
25
+ digitalWrite (RGB_BUILTIN , HIGH); // Turn the RGB LED white
26
26
delay (1000 );
27
- digitalWrite (LED_BUILTIN , LOW); // Turn the RGB LED off
27
+ digitalWrite (RGB_BUILTIN , LOW); // Turn the RGB LED off
28
28
delay (1000 );
29
29
30
- neopixelWrite (LED_BUILTIN,LED_BRIGHTNESS ,0 ,0 ); // Red
30
+ neopixelWrite (RGB_BUILTIN,RGB_BRIGHTNESS ,0 ,0 ); // Red
31
31
delay (1000 );
32
- neopixelWrite (LED_BUILTIN ,0 ,LED_BRIGHTNESS ,0 ); // Green
32
+ neopixelWrite (RGB_BUILTIN ,0 ,RGB_BRIGHTNESS ,0 ); // Green
33
33
delay (1000 );
34
- neopixelWrite (LED_BUILTIN ,0 ,0 ,LED_BRIGHTNESS ); // Blue
34
+ neopixelWrite (RGB_BUILTIN ,0 ,0 ,RGB_BRIGHTNESS ); // Blue
35
35
delay (1000 );
36
- neopixelWrite (LED_BUILTIN ,0 ,0 ,0 ); // Off / black
36
+ neopixelWrite (RGB_BUILTIN ,0 ,0 ,0 ); // Off / black
37
37
delay (1000 );
38
38
#endif
39
39
}
0 commit comments