Skip to content

Instantly share code, notes, and snippets.

@orangecoding
Last active January 17, 2021 09:52
Show Gist options
  • Save orangecoding/5ce5b042318f0cf262cbb5be469329d6 to your computer and use it in GitHub Desktop.
Save orangecoding/5ce5b042318f0cf262cbb5be469329d6 to your computer and use it in GitHub Desktop.
Night light using an ESP 8266 and an Ardafruit NeoPixel Ring
#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