Last active
November 6, 2021 20:16
-
-
Save urish/19e3922f4d8468bbe6bc to your computer and use it in GitHub Desktop.
Simple NeoPixel Animation for Arduino on WeMos D1 Mini, License: MIT
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 NUM_PIXELS 24 | |
Adafruit_NeoPixel pixels(NUM_PIXELS, D2, NEO_GRB | NEO_KHZ800); | |
void setup() { | |
pixels.begin(); | |
} | |
void setColor(uint32_t color) { | |
for (int i = 0; i < NUM_PIXELS; i++) { | |
pixels.setPixelColor(i, color); | |
pixels.show(); | |
delay(50); | |
} | |
} | |
void loop() { | |
setColor(pixels.Color(100, 0, 0)); | |
delay(1000); | |
setColor(pixels.Color(0, 100, 0)); | |
delay(1000); | |
setColor(pixels.Color(0, 0, 100)); | |
delay(1000); | |
} |
Hi, Need help.....! I am unisg WeMos D1R2 and WS2812B Led Lights. I had use your code but nothing happening. Can you please help.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If this is for an ESP, isn't the delay function a bad idea? This should use a timer and millis, and there is a lib called simple timer that makes it easy. If you use delay with wifi functions, it can lose the wifi connection.