본문 바로가기

코딩 놀이

4자리 카운터 TM1637

 0~ 9999까지 증가되는 카운터입니다.

 

준비물 :아두이노 나노, TM1637, 적외선 포토 커플러, 점프선

 


#include <TM1637Display.h>
const int CLK = 4; 
const int DIO = 5; 
TM1637Display display(CLK, DIO); 
const uint8_t blank[] = {0x3f, 0x3f, 0x3f, 0x3f};
int CounterUp = 0;

void setup(){
  pinMode(2, INPUT_PULLUP);
  attachInterrupt(0, opti, RISING);
  display.setBrightness(0x0a); 
  display.setSegments(blank);
}

void loop(){
}

void opti() {
  CounterUp++;          
  display.showNumberDec(CounterUp, true, 4, 0);
  if (CounterUp > 9999)CounterUp = 0;
}

 

'코딩 놀이' 카테고리의 다른 글

Ethernet shileds  (0) 2021.04.02
esp-01 어뎁터  (0) 2021.03.31
ethernet AcMotor control  (0) 2021.03.09
WiFi 공유기 접속 IP 알아보기  (0) 2021.03.09
tag [ align]  (0) 2021.03.09