Created
July 17, 2019 12:27
-
-
Save mrmemmo/f22e25ac30ce8f0558d3f5309028c1e3 to your computer and use it in GitHub Desktop.
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 <Adafruit_NeoPixel.h> | |
| #define PIN 6 | |
| #define N_LEDS 144 | |
| Adafruit_NeoPixel strip = Adafruit_NeoPixel(N_LEDS, PIN, NEO_GRB + NEO_KHZ800); | |
| void setup() { | |
| strip.begin(); | |
| } | |
| void loop() { | |
| strip.setPixelColor(1 , strip.Color(255, 0, 0)); // Draw new pixel | |
| strip.show(); | |
| delay(2500); | |
| strip.setPixelColor(1, 0); // Erase pixel a few steps back | |
| strip.show(); | |
| delay(2500); | |
| /* | |
| chase(strip.Color(255, 0, 0)); // Red | |
| chase(strip.Color(0, 255, 0)); // Green | |
| chase(strip.Color(0, 0, 255)); // Blue | |
| */ | |
| } | |
| static void chase(uint32_t c) { | |
| for(uint16_t i=0; i<strip.numPixels()+4; i++) { | |
| strip.setPixelColor(i , c); // Draw new pixel | |
| strip.setPixelColor(i-4, 0); // Erase pixel a few steps back | |
| strip.show(); | |
| delay(25); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment