|
本帖最后由 topdog 于 2022-1-27 07:08 编辑
请参考 https://www.arduino.cn/thread-94653-1-2.html
根据你的程序修改如下:
[pre]#include "TM1637.h"
const int CLK = 2;
const int DIO = 3;
const int LED = 13;
bool flag = false;
TM1637 tm1637(CLK, DIO);
void setup() {
tm1637.init();
tm1637.set(BRIGHT_TYPICAL);
pinMode(LED, OUTPUT);
}
void loop() {
tm1637.display(0,0);
tm1637.display(1,0);
tm1637.display(2,0);
for (int i = 0; i < 10; i++) {
tm1637.display(3, i);
delay(1000);
if (i == 9) flag = true;
}
if (flag == true ) {
digitalWrite(LED, HIGH);
delay(1000);
digitalWrite(LED, LOW);
delay(1000);
flag = false;
}
}[/pre]
用nano实测正常的。
|
|