View difference between Paste ID: PCsT6sYW and mcg4zRkb
SHOW: | | - or go back to the newest paste.
1-
#include "SmartMatrix.h"
1+
    #include "SmartMatrix.h"
2-
#include "FastLED.h"
2+
    #include "FastLED.h"
3-
#include "Time.h"
3+
    #include "Time.h"
4
     
5-
#define kMatrixWidth  32
5+
    #define kMatrixWidth  32
6-
#define kMatrixHeight 32
6+
    #define kMatrixHeight 32
7-
const bool    kMatrixSerpentineLayout = false;
7+
    const bool    kMatrixSerpentineLayout = false;
8
     
9-
#define NUM_LEDS (kMatrixWidth * kMatrixHeight)
9+
    uint32_t nextFrame = 0;
10
11-
CRGB leds[kMatrixWidth * kMatrixHeight];
11+
    #define NUM_LEDS (kMatrixWidth * kMatrixHeight)
12
    #define DEFAULT_BRIGHTNESS 255
13-
const rgb24 COLOR_BLACK = { 0,0,0 };
13+
14-
const rgb24 COLOR_WHITE = { 255,255,255};
14+
    CRGB leds[kMatrixWidth * kMatrixHeight];
15
     
16-
time_t getTeensy3Time()
16+
    const rgb24 COLOR_BLACK = { 0,0,0 };
17-
{
17+
    const rgb24 COLOR_WHITE = { 255,255,255};
18-
  return Teensy3Clock.get();
18+
     
19-
}
19+
    time_t getTeensy3Time()
20
    {
21-
void setup() {
21+
      return Teensy3Clock.get();
22-
  LEDS.addLeds<SmartMatrix>(leds,NUM_LEDS);
22+
    }
23-
	LEDS.setBrightness(DEFAULT_BRIGHTNESS);
23+
     
24-
	pSmartMatrix->setColorCorrection(cc24);
24+
    void setup() {
25-
 	setSyncProvider(getTeensy3Time);
25+
      LEDS.addLeds<SmartMatrix>(leds,NUM_LEDS);
26-
	pSmartMatrix->fillScreen(COLOR_BLACK);
26+
            LEDS.setBrightness(DEFAULT_BRIGHTNESS);
27-
	LEDS.show();
27+
            pSmartMatrix->setColorCorrection(cc24);
28-
}
28+
            setSyncProvider(getTeensy3Time);
29
            pSmartMatrix->fillScreen(COLOR_BLACK);
30-
void loop() { 
30+
            LEDS.show();
31-
	digitalClock();
31+
    }
32-
}
32+
     
33
    void loop() {
34-
void digitalClock() { 
34+
            digitalClock();
35-
  if(millis() >= nextFrame) { 
35+
            LEDS.show();
36-
    char str[32];
36+
    }
37-
    sprintf(str,"%02d", hour());
37+
     
38-
    pSmartMatrix->setFont(font5x7);
38+
    void digitalClock() {
39-
    pSmartMatrix->fillScreen(CRGB(CHSV(100,0,255)));
39+
      if(millis() >= nextFrame) {
40-
    pSmartMatrix->fillRectangle(0,0,31,15,CRGB(CHSV(0,255,255)));
40+
        char str[32];
41-
    pSmartMatrix->fillRoundRectangle(3,12,28,19,1,CRGB(CHSV(0,0,0)));
41+
        sprintf(str,"%02d", hour());
42-
    pSmartMatrix->drawString(4,13,CRGB(CHSV(255,0,255)),str);
42+
        pSmartMatrix->setFont(font5x7);
43-
    sprintf(str,"%02d", minute());
43+
        pSmartMatrix->fillScreen(CRGB(CHSV(100,0,255)));
44-
    pSmartMatrix->drawString(19,13,CRGB(255,255,255),str);
44+
        pSmartMatrix->fillRectangle(0,0,31,15,CRGB(CHSV(0,255,255)));
45-
    if(second()%2) {
45+
        pSmartMatrix->fillRoundRectangle(3,12,28,19,1,CRGB(CHSV(0,0,0)));
46-
     pSmartMatrix->drawString(13,12,CRGB(255,255,255),":");
46+
        pSmartMatrix->drawString(4,13,CRGB(CHSV(255,0,255)),str);
47-
    } 
47+
        sprintf(str,"%02d", minute());
48-
    nextFrame = millis() + 1000;
48+
        pSmartMatrix->drawString(19,13,CRGB(255,255,255),str);
49-
  }
49+
        if(second()%2) {
50-
}
50+
         pSmartMatrix->drawString(13,12,CRGB(255,255,255),":");
51
        }
52
        nextFrame = millis() + 1000;
53
      }
54
    }