Created
February 18, 2023 00:36
-
-
Save katsuyoshi/41a3b3bfd8dfa2d24c095900259329e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <FastLED.h> | |
#define LED_PIN 21 | |
#define NUM_LEDS 1 | |
static CRGB leds[NUM_LEDS]; | |
void setLed(CRGB color) { | |
// change RGB to GRB | |
uint8_t t = color.r; | |
color.r = color.g; | |
color.g = t; | |
leds[0] = color; | |
FastLED.show(); | |
} | |
void setup() { | |
FastLED.addLeds<WS2811, LED_PIN, RGB>(leds, NUM_LEDS); | |
FastLED.setBrightness(255 * 15 / 100); | |
} | |
void loop() { | |
setLed(CRGB::Red); | |
delay(1000); | |
setLed(CRGB::Green); | |
delay(1000); | |
setLed(CRGB::Blue); | |
delay(1000); | |
setLed(CRGB::Black); | |
delay(1000); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[env:esp32-s3-devkitc-1] | |
platform = espressif32 | |
board = esp32-s3-devkitc-1 | |
framework = arduino | |
build_flags = | |
-DARDUINO_USB_MODE=1 | |
-DARDUINO_USB_CDC_ON_BOOT=1 | |
monitor_speed = 115200 | |
lib_deps = fastled/FastLED@^3.5.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment