Last active
December 28, 2020 14:03
-
-
Save konsumer/482b1534b77343dbfbf10c8996df8023 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 2 // D4 on nodemcu | |
#define NUMPIXELS 50 | |
#define DELAYVAL 500 | |
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_RGB + NEO_KHZ800); | |
void setup() { | |
pixels.begin(); | |
} | |
void loop() { | |
pixels.clear(); | |
for(int i=0; i<NUMPIXELS; i++) { | |
pixels.setPixelColor(i, pixels.Color(255, 0, 0)); | |
pixels.show(); | |
delay(DELAYVAL); | |
} | |
for(int i=0; i<NUMPIXELS; i++) { | |
pixels.setPixelColor(i, pixels.Color(0, 0, 0)); | |
pixels.show(); | |
delay(DELAYVAL); | |
} | |
} |
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> | |
#define PIN 2 // D4 on nodemcu | |
#define NUMPIXELS 50 | |
#define DELAYVAL 500 | |
CRGB leds[NUMPIXELS]; | |
void setup() { | |
FastLED.addLeds<WS2811, PIN, RGB>(leds, NUMPIXELS); | |
} | |
void loop() { | |
for(int i=0; i<NUMPIXELS; i++) { | |
leds[i] = CRGB::Red; | |
FastLED.show(); | |
delay(DELAYVAL); | |
} | |
for(int i=0; i<NUMPIXELS; i++) { | |
leds[i] = CRGB::Black; | |
FastLED.show(); | |
delay(DELAYVAL); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment