数码管
arduino从零开始(21)
你将学到什么
你将学到如何使用TM1637芯片控制四位数码管的显示
库下载地址:
1、
2、
文字代码
#include "TM1637.h"
#define CLK 2
//pins definitions for TM1637 and can be changed to other ports
#define DIO 3
TM1637 tm1637(CLK,DIO);
void setup() {
// put your setup code here, to run once:
();
(BRIGHT_TYPICAL);
//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
}
void loop() {
// put your main code here, to run repeatedly:
int8_t NumTab[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
//0~9,A,b,C,d,E,F
(true);//显示中间的分号
(0,NumTab[1]);//控制每一位数码管的显示
(1,NumTab[2]);
(2,NumTab[3]);
(3,NumTab[4]);
}
视频内容详解:arduino四位数码显示管使用(视频)