一、秒表
#include <SevenSegmentExtended.h>
#include <SevenSegmentTM1637.h>
volatile int MINUTE;
volatile int SECOND;
SevenSegmentExtended display(5,13);
void setup(){
MINUTE = 0;
SECOND = 0;
display.begin();
}
void loop(){
display.setBacklight(20);
display.printTime(MINUTE,SECOND,HIGH);
if (SECOND == 59) {
MINUTE = MINUTE + 1;
SECOND = 0;
}
SECOND = SECOND + 1;
if (MINUTE == 60) {
MINUTE = 0;
}
delay(1000);
}
二、自定义时间
#include <SevenSegmentExtended.h>
#include <SevenSegmentTM1637.h>
volatile int MINUTE;
volatile int SECOND;
SevenSegmentExtended display(5,13);
void setup(){
MINUTE = 15;
SECOND = 34;
display.begin();
}
void loop(){
display.setBacklight(20);
display.printTime(MINUTE,SECOND,HIGH);
}
三、自定义滚动字符
#include <SevenSegmentTM1637.h>
SevenSegmentTM1637 display(5,13);
void setup(){
display.begin();
}
void loop(){
display.setBacklight(20);
display.print("lalalasdsa123123");
}