commands:reference:irtcread
문서의 이전 판입니다!
목차
IrtcRead()
명령어
| 명령어 | 인수 | 반환값 | 동작 |
|---|---|---|---|
IrtcRead(dateTime) | IrtcDateTime& dateTime | bool | RTC의 날짜와 시간을 읽습니다. |
예제
void setup() { Serial.begin(115200); if (!IrtcBegin()) { Serial.println(F("DS3231 connection failed")); return; } // 최초 한 번 실행한 뒤 주석 처리합니다. // IrtcSet(2026, 8, 10, 14, 30, 0); } void loop() { IrtcDateTime now; if (IrtcRead(now)) { Serial.print(now.year); Serial.print('/'); Serial.print(now.month); Serial.print('/'); Serial.print(now.day); Serial.print(' '); Serial.print(now.hour); Serial.print(':'); Serial.print(now.minute); Serial.print(':'); Serial.println(now.second); } delay(1000); }
주의사항
각 장치는 해당 Begin 명령어를 먼저 실행하십시오. I²C 주소와 핀 공유 여부를 확인하고, bool 반환값이 false이면 배선과 전원을 점검하십시오.
commands/reference/irtcread.1788260661.txt.gz · 마지막으로 수정됨: 저자 127.0.0.1
