#include <TM1637Display.h>
#define CLK 2
#define DIO 3
TM1637Display display = TM1637Display(CLK, DIO);
const uint8_t data[]= {0xff,0xff,0xff,0xff};
const uint8_t blank[]= {0x00, 0x00, 0x00, 0x00};
const uint8_t done[] = {
SEG_B | SEG_C | SEG_D | SEG_E | SEG_G,
SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F,
SEG_C | SEG_E | SEG_G,
SEG_A | SEG_D | SEG_E | SEG_F | SEG_G
};
const uint8_t celsius[] = {
SEG_A | SEG_B | SEG_F | SEG_G,
SEG_A | SEG_D | SEG_E | SEG_F
};
void setup() {
display.clear();
delay(1000);
}
void loop() {
display.setBrightness(7);
display.setSegments(data);
delay(1000);
display.clear();
delay(1000);
int i;
for (i = 0;i < 101; i++){
display.showNumberDec(i);
delay(50);
}
delay(1000);
display.clear();
delay(1000);
int j;
for (j=0;j<2;j++){
for (i=0;i<4;i++){
display.showNumberDec(i,false,1,i);
delay(500);
display.clear();
}
}
delay(1000);
display.clear();
delay(1000);
int k;
for (k=0;k<8;k++){
display.setBrightness(k);
display.setSegments(data);
delay(500);
}
delay(1000);
display.clear();
delay(1000);
display.showNumberDecEx(1234,0b11100000,false,4,0);
delay(1000);
display.clear();
delay(1000);
int temperature = 24;
display.showNumberDec(temperature, false, 2, 0);
display.setSegments(celsius, 2, 2);
delay(1000);
display.clear();
delay(1000);
display.setSegments(done);
while (1);
}