Structure clock reads and timestamped behavior for RTC modules.
Open in compiler →/*
Roboda verified Arduino sample 0795
Feature: RTC Clock Shell
Generated for online build, classroom practice, and hardware upload testing.
*/
unsigned long secondsFromBoot = 0;
unsigned long lastTick = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
if (millis() - lastTick >= 1000) {
lastTick += 1000;
secondsFromBoot++;
Serial.print("rtc-shell-seconds=");
Serial.println(secondsFromBoot);
}
}
How it works
Practice this Arduino feature with a verified Roboda sketch.
- Read the constants at the top of the sketch.
- Wire the pins exactly as listed in the pin map.
- Upload or compile once before changing values.
- Change one value at a time and watch Serial Monitor or the output device.
Connections
| Pin | Connect to | Note |
|---|---|---|
| SDA / SCL if adding RTC hardware | DS3231/DS1307 RTC module | This shell prints boot seconds; add Wire/RTC library for real clock hardware. |