Last active
January 17, 2021 09:52
-
-
Save orangecoding/5ce5b042318f0cf262cbb5be469329d6 to your computer and use it in GitHub Desktop.
Night light using an ESP 8266 and an Ardafruit NeoPixel Ring
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> | |
#ifdef __AVR__ | |
#include <avr/power.h> | |
#endif | |
#define PIN D4 | |
#define NUMPIXELS 13 | |
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); | |
#define DELAYVAL 500 | |
void setup() { | |
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000) | |
clock_prescale_set(clock_div_1); | |
#endif | |
pixels.begin(); | |
//neded, otherwise the initialization is not done until we run through the pixels | |
//which will leave some led's green | |
delay(1); | |
for(int i=0; i<NUMPIXELS; i++) { | |
//turn color to red | |
pixels.setPixelColor(i, pixels.Color(900, 0, 0, 0)); | |
} | |
pixels.show(); | |
} | |
void loop() {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment