#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()
{
tm1637.init();
tm1637.set(BRIGHT_TYPICAL);//BRIGHT_TYPICAL = 2,BRIGHT_DARKEST = 0,BRIGHTEST = 7;
}
void loop()
{
int cnt1=0,cnt10=0,cnt100=0, cnt1000=0;;
delay(150);
while(1)
{
tm1637.display(0,cnt1000); // 1000
tm1637.display(1,cnt100); // 100
tm1637.display(2,cnt10); // 10
tm1637.display(3,cnt1); // 1
delay(10);
cnt1++;
if(cnt1>9)
{
cnt10++;
cnt1=0;
}
else if(cnt10>9)
{
cnt100++;
cnt10=0;
}
else if(cnt100>9)
{
cnt1000++;
cnt100=0;
}
else if(cnt1000>9)
{
cnt1000=0;
}
else ;
}
}
'Study > Arduino' 카테고리의 다른 글
Intel Galileo (0) | 2014.09.15 |
---|---|
ADC Value 를 FND로 출력 (0) | 2014.09.15 |
4-Digit Display header file (0) | 2014.09.15 |
Grove-LCD RGB Backlight header file (0) | 2014.09.15 |
SW체터링 소프트웨어적 해결 (0) | 2014.09.05 |