Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SmartMatrix.h"
- #include "FastLED.h"
- #include "Time.h"
- #define kMatrixWidth 32
- #define kMatrixHeight 32
- const bool kMatrixSerpentineLayout = false;
- #define NUM_LEDS (kMatrixWidth * kMatrixHeight)
- CRGB leds[kMatrixWidth * kMatrixHeight];
- const rgb24 COLOR_BLACK = { 0,0,0 };
- const rgb24 COLOR_WHITE = { 255,255,255};
- time_t getTeensy3Time()
- {
- return Teensy3Clock.get();
- }
- void setup() {
- LEDS.addLeds<SmartMatrix>(leds,NUM_LEDS);
- LEDS.setBrightness(DEFAULT_BRIGHTNESS);
- pSmartMatrix->setColorCorrection(cc24);
- setSyncProvider(getTeensy3Time);
- pSmartMatrix->fillScreen(COLOR_BLACK);
- LEDS.show();
- }
- void loop() {
- digitalClock();
- }
- void digitalClock() {
- if(millis() >= nextFrame) {
- char str[32];
- sprintf(str,"%02d", hour());
- pSmartMatrix->setFont(font5x7);
- pSmartMatrix->fillScreen(CRGB(CHSV(100,0,255)));
- pSmartMatrix->fillRectangle(0,0,31,15,CRGB(CHSV(0,255,255)));
- pSmartMatrix->fillRoundRectangle(3,12,28,19,1,CRGB(CHSV(0,0,0)));
- pSmartMatrix->drawString(4,13,CRGB(CHSV(255,0,255)),str);
- sprintf(str,"%02d", minute());
- pSmartMatrix->drawString(19,13,CRGB(255,255,255),str);
- if(second()%2) {
- pSmartMatrix->drawString(13,12,CRGB(255,255,255),":");
- }
- nextFrame = millis() + 1000;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment