Advertisement
Guest User

Untitled

a guest
Dec 5th, 2021
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <FastLED.h>
  3.  
  4. // GPIO for LED on development board
  5. #define PIN_LED_BUILTIN 2
  6.  
  7. // LED related defines
  8. #define NUM_LEDS 10
  9. #define PIN_DATA 23
  10.  
  11. // Define the array of leds
  12. CRGB leds[NUM_LEDS];
  13.  
  14. void setup() {
  15.  
  16.   // put your setup code here, to run once:
  17.   pinMode(PIN_LED_BUILTIN, OUTPUT);
  18.  
  19.   // Setup LED strip
  20.   FastLED.addLeds<SK6812, PIN_DATA, GRB>(leds, NUM_LEDS);  // GRB ordering is typical
  21.  
  22. }
  23.  
  24. void loop() {
  25.  
  26.   // put your main code here, to run repeatedly:
  27.   // Builtin LED is left in as a sanity check
  28.   digitalWrite(PIN_LED_BUILTIN, HIGH);
  29.   leds[0] = CRGB::Red;
  30.   FastLED.show();
  31.  
  32.   delay(1000);
  33.  
  34.   digitalWrite(PIN_LED_BUILTIN, LOW);
  35.   leds[0] = CRGB::Black;
  36.   FastLED.show();
  37.  
  38.   delay(1000);
  39.  
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement