Created
December 19, 2016 18:41
-
-
Save BraedenYoung/c4c38bb540cb6f674418c166ae1f4b3e to your computer and use it in GitHub Desktop.
Simple sketch to light up Neopixels
This file contains hidden or 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" | |
// How many leds in your strip? | |
#define NUM_LEDS 60 | |
// For led chips like Neopixels, which have a data line, ground, and power, you just | |
// need to define DATA_PIN. | |
#define DATA_PIN 5 | |
// Define the array of leds | |
CRGB leds[NUM_LEDS]; | |
void setup() { | |
// Add the LEDs | |
FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); | |
} | |
void loop() { | |
// Tunn all the LEDs red one by one | |
for (int i=0; i < NUM_LEDS; i++){ | |
leds[i] = CRGB::Red; | |
FastLED.show(); | |
delay(500); | |
} | |
// Tunn all the LEDs blue one by one | |
for (int i=NUM_LEDS-1; i < 0; i--){ | |
leds[i] = CRGB::Blue; | |
FastLED.show(); | |
delay(500); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment