Created
December 13, 2016 05:23
-
-
Save marmilicious/b6bb31f5dad644b1c1a9f6ef4c61df4e 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 "FastLED.h" | |
#define LED_TYPE LPD8806 | |
#define DATA_PIN 11 | |
#define CLOCK_PIN 13 | |
#define NUM_LEDS 32 | |
CRGB leds[NUM_LEDS]; | |
uint8_t time; | |
//------------------------------------------------------------------ | |
void setup(){ | |
Serial.begin(115200); // Allows serial monitor output (check baud rate) | |
delay(2500); // Power-up delay | |
FastLED.addLeds<LED_TYPE, DATA_PIN, CLOCK_PIN, GRB>(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); | |
FastLED.setBrightness(50); | |
} | |
//------------------------------------------------------------------ | |
void loop() { | |
EVERY_N_MILLISECONDS(40){ | |
time++; | |
for (int i = 0; i < NUM_LEDS; i++) { | |
leds[(i + time) % NUM_LEDS] = CHSV( 42, 255, sin8((65535 / NUM_LEDS) * i * 3) ); | |
} | |
LEDS.show(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment