// Create the myRTC object virtuabotixRTC myRTC(RST, DAT, CLK);
Wiring issue or poor connection on CLK, DAT, or RST lines. Fix: Check all jumper wires. Use shorter wires. Add 10k pull-up resistors on DAT and CLK if the wires are long.
The DS1302 communicates via command bytes. Each read or write operation starts with a command byte containing: virtuabotixrtc.h arduino library
// Open file and log dataFile = SD.open("datalog.txt", FILE_WRITE); if (dataFile) dataFile.print(myRTC.getDateStr()); dataFile.print(","); dataFile.print(myRTC.getTimeStr()); dataFile.print(","); dataFile.println(temperatureC); dataFile.close();
Once myRTC.updateTime() is called, you can access the following public variables: // Create the myRTC object virtuabotixRTC myRTC(RST, DAT,
// CLK, DAT, RST pins VirtuabotixRTC myRTC(6, 7, 8);
This project logs temperature (from a TMP36 sensor) to an SD card alongside the current time. Add 10k pull-up resistors on DAT and CLK
setDS1302Time(second, minute, hour, dayofweek, dayofmonth, month, year)
// Turn on the backlight if using a compatible LCD // lcd.backlight(); // Uncomment for I2C LCDs
Connecting a standard DS1302 module to your Arduino is straightforward. The module typically has 5 pins: VCC , GND , CLK , DAT , and RST .
// Create the myRTC object virtuabotixRTC myRTC(RST, DAT, CLK);
Wiring issue or poor connection on CLK, DAT, or RST lines. Fix: Check all jumper wires. Use shorter wires. Add 10k pull-up resistors on DAT and CLK if the wires are long.
The DS1302 communicates via command bytes. Each read or write operation starts with a command byte containing:
// Open file and log dataFile = SD.open("datalog.txt", FILE_WRITE); if (dataFile) dataFile.print(myRTC.getDateStr()); dataFile.print(","); dataFile.print(myRTC.getTimeStr()); dataFile.print(","); dataFile.println(temperatureC); dataFile.close();
Once myRTC.updateTime() is called, you can access the following public variables:
// CLK, DAT, RST pins VirtuabotixRTC myRTC(6, 7, 8);
This project logs temperature (from a TMP36 sensor) to an SD card alongside the current time.
setDS1302Time(second, minute, hour, dayofweek, dayofmonth, month, year)
// Turn on the backlight if using a compatible LCD // lcd.backlight(); // Uncomment for I2C LCDs
Connecting a standard DS1302 module to your Arduino is straightforward. The module typically has 5 pins: VCC , GND , CLK , DAT , and RST .