Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif
#define PIN 13
#define BLUE strip.Color(0,0,255)
#define BLACK strip.Color(0,0,0)
#define GREEN strip.Color(0,255,0)
#define RED strip.Color(255,0,0)
#define WHITE strip.Color(255,255,255)
#define PIXELOFFSET 6
Adafruit_NeoPixel strip = Adafruit_NeoPixel(12, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// put your setup code here, to run once:
strip.begin();
strip.show();
}
void loop() {
// put your min code here, to run repeatedly:
//strip.setPixelColor(6, BLUE);
//strip.show();
delay(3000);
for (int i=0; i<24; i++) {
for (int j=0; j<60; j++) {
for (int k=0; k<60; k++){
setClock(i, j, k);
delay(10);
}
}
}
}
void setClock (int hour, int minute, int sec) {
for(int i=0; i<12; i++){
strip.setPixelColor(i, BLACK);
}
strip.setPixelColor((sec/5+PIXELOFFSET)%12, RED);
strip.setPixelColor((minute/5+PIXELOFFSET)%12, BLUE);
strip.setPixelColor((hour+PIXELOFFSET)%12, WHITE);
strip.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.