Created
April 2, 2016 13:55
-
-
Save mschlenker/c0772d21753873df07b25acacb49a59e to your computer and use it in GitHub Desktop.
This file contains 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 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