Advertisement
sprocket2cog

Fastled "corner pulse sin8"

Nov 7th, 2015
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. //----------------------------------------------
  2. //2015 sprocket2cog CC.
  3. // 8x8 matrix (non serpentine) "corner pulse sketch"
  4. //----------------------------------------------
  5. #include "FastLED.h"
  6. #define DATA_PIN    6
  7. #define CHIPSET     WS2812B
  8. #define COLOR_ORDER GRB
  9. #define NUM_LEDS    64
  10. #define BRIGHTNESS  255
  11. CRGB leds[NUM_LEDS];
  12. int x=0;
  13. void setup() {
  14.    FastLED.addLeds<CHIPSET, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  15.    LEDS.setBrightness(BRIGHTNESS);
  16. }
  17. void loop() {
  18.    drawPixels();
  19.    FastLED.show();
  20.    x=x+1;
  21.    for (int i = 0 ; i < NUM_LEDS; i++) {
  22.     leds[i] = CRGB::Black;
  23. };
  24.   FastLED.show();
  25.   }
  26. void drawPixels(){
  27.    leds[sin8(x)/32] = CHSV(cos8(x),200,200);
  28.    leds[(sin8(7-x)/32)*8] = CHSV(cos8(x),200,200);
  29.    leds[sin8(7-x)/32] = CHSV(sin8(x),200,200);
  30.    leds[(sin8(x)/32)*8] = CHSV(cos8(x),200,200);
  31.    leds[(sin8(x)/32)*8+7] = CHSV(sin8(x),200,200);
  32.    leds[(sin8(x)/32)+56] = CHSV(cos8(x),200,200);
  33.    leds[(sin8(7-x)/32)*8+7] = CHSV(sin8(x),200,200);
  34.    leds[sin8(7-x)/32+56] = CHSV(sin8(x),200,200);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement