HighInBC

WS2812b lighting for Quad

Jun 22nd, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <Adafruit_NeoPixel.h>
  2. #ifdef __AVR__
  3.   #include <avr/power.h>
  4. #endif
  5.  
  6. #define PIN 4
  7. Adafruit_NeoPixel strip = Adafruit_NeoPixel(24, PIN, NEO_GRB + NEO_KHZ800);
  8. uint32_t RED   = strip.Color( 255, 0, 0 );
  9. uint32_t WHITE = strip.Color( 255, 255, 255 );
  10. uint32_t LEDColours[24] = {
  11.   RED, RED, RED,
  12.   RED, RED, RED,
  13.   WHITE, WHITE, WHITE,
  14.   WHITE, WHITE, WHITE,
  15.   WHITE, WHITE, WHITE,
  16.   WHITE, WHITE, WHITE,
  17.   RED, RED, RED,
  18.   RED, RED, RED
  19. };
  20.  
  21. void setup() {
  22.   strip.begin();
  23.   strip.show();
  24.   for(uint16_t i=0; i<strip.numPixels(); i++) {
  25.     strip.setPixelColor(i, LEDColours[i]);
  26.     strip.show();
  27.   }
  28. }
  29.  
  30. void loop() {
  31. }
Advertisement
Add Comment
Please, Sign In to add comment