实验一--Mixly数码管时钟实验
程序员文章站
2022-05-27 17:06:48
...
#include <SevenSegmentExtended.h>
#include <SevenSegmentTM1637.h>
SevenSegmentExtended display(3,4);
volatile int minute;
volatile int second;
void setup(){
second = 0;
minute = 0;
display.begin();
}
void loop(){
display.setBacklight(20);
display.printTime(minute,second,HIGH);
delay(1000);
if (second == 59) {//当秒针走到59
minute = minute + 1;//分钟加1
second = 0;//把秒设为0
} else {
second = second + 1;
}
if (minute == 59) {//当分钟走到59时
minute = 0;把分钟设为0
}
}
运行结果截图:
图形化截图: