개발보드/프로그래머
관련상품
등록된 상품이 없습니다.
상품 정보
상품 상세설명
상품상세정보
![[D-115]_04.png](http://cafe24.poxo.com/ec01/eduino/z3YOBqiuI6lC0rXfWithEdL8SAf/9jOIHTKXoHbfMjZOS9Mp8dOpClrfXnF29gSPkhICt0X4UNZW+O/pv2ZMoQ==/_/product/d/115/%5BD-115%5D_04.png)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include <Arduino.h> #include <TM1637Display.h> #define CLK 9 #define DIO 8 TM1637Display display(CLK, DIO); // TM1637 디스플레이 객체 생성 int Sec1, Sec2, Min1, Min2, Tm1, Tm2 = 0; // 시간 변수 선언 unsigned long previousTime, currentTime; // 이전 및 현재 시간 변수 선언 uint8_t data[] = {0x0, 0x0, 0x0, 0x0}; // 디스플레이에 표시할 데이터 배열 uint8_t segto; // 디스플레이에 표시할 세그먼트 값 void setup() { previousTime = millis(); // 이전 시간 초기화 display.setBrightness(0xF); // 디스플레이 밝기 설정 Serial.begin(9600); // 시리얼 통신 시작 } void loop() { currentTime = millis() / 1000; // 현재 시간 계산 (초 단위) // 각 자릿수를 계산 Sec2 = currentTime % 10; Sec1 = (currentTime / 10) % 10; Min2 = (currentTime / 100) % 10; Min1 = (currentTime / 1000) % 10; // 디스플레이에 표시할 데이터 배열 설정 data[0] = display.encodeDigit(Min1); data[1] = display.encodeDigit(Min2); data[2] = display.encodeDigit(Sec1); data[3] = display.encodeDigit(Sec2); // 두 번째 자릿수의 세그먼트 설정 segto = 0x80 | display.encodeDigit(Min2); // 디스플레이에 데이터 및 두 번째 자릿수의 세그먼트 표시 display.setSegments(data); display.setSegments(&segto, 1, 1); delay(500); // 500ms 지연 // 디스플레이 초기화 및 500ms 지연 display.setSegments(data); delay(500); } | cs |
사용후기
등록된 사용후기
사용후기가 없습니다.
상품문의
등록된 상품문의
상품문의가 없습니다.
배송정보









