Skip to content

Commit 299a450

Browse files
Update BlinkRGB example
Update example code for changes with the RGB driver: - Replace `LED_BUILTIN` and `BOARD_HAS_NEOPIXEL` with `RGB_BUILTIN` - Replace `LED_BRIGHTNESS` with `RGB_BRIGHTNESS`
1 parent 386e7e7 commit 299a450

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

libraries/ESP32/examples/GPIO/BlinkRGB/BlinkRGB.ino

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
44
Demonstrates usage of onboard RGB LED on some ESP dev boards.
55
6-
Calling digitalWrite(LED_BUILTIN, HIGH) will use hidden RGB driver.
6+
Calling digitalWrite(RGB_BUILTIN, HIGH) will use hidden RGB driver.
77
88
RGBLedWrite demonstrates controll of each channel:
99
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
1010
1111
WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin
1212
with normal HIGH/LOW level
1313
*/
14-
//#define LED_BRIGHTNESS 64 // Change white brightness (max 255)
14+
//#define RGB_BRIGHTNESS 64 // Change white brightness (max 255)
1515

1616
// the setup function runs once when you press reset or power the board
1717

@@ -21,19 +21,19 @@ void setup() {
2121

2222
// the loop function runs over and over again forever
2323
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
2626
delay(1000);
27-
digitalWrite(LED_BUILTIN, LOW); // Turn the RGB LED off
27+
digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off
2828
delay(1000);
2929

30-
neopixelWrite(LED_BUILTIN,LED_BRIGHTNESS,0,0); // Red
30+
neopixelWrite(RGB_BUILTIN,RGB_BRIGHTNESS,0,0); // Red
3131
delay(1000);
32-
neopixelWrite(LED_BUILTIN,0,LED_BRIGHTNESS,0); // Green
32+
neopixelWrite(RGB_BUILTIN,0,RGB_BRIGHTNESS,0); // Green
3333
delay(1000);
34-
neopixelWrite(LED_BUILTIN,0,0,LED_BRIGHTNESS); // Blue
34+
neopixelWrite(RGB_BUILTIN,0,0,RGB_BRIGHTNESS); // Blue
3535
delay(1000);
36-
neopixelWrite(LED_BUILTIN,0,0,0); // Off / black
36+
neopixelWrite(RGB_BUILTIN,0,0,0); // Off / black
3737
delay(1000);
3838
#endif
3939
}

0 commit comments

Comments
 (0)