Library Best: Virtuabotixrtc.h Arduino
void loop() myRTC.updateTime(); int tempReading = analogRead(A0); float voltage = tempReading * (5.0 / 1023.0); float temperatureC = (voltage - 0.5) * 100;
#include <virtuabotixRTC.h> virtuabotixRTC myRTC(2, 3, 4); void setup() Serial.begin(9600); virtuabotixrtc.h arduino library
delay(60000); // Log every minute
When you first power a new DS1302 chip, the time is random. You must set it. Important: You should only run the setting code once and then comment it out. Writing to the RTC every loop wears out the memory. void loop() myRTC
// Create the RTC object virtuabotixRTC myRTC(RTC_RST, RTC_DAT, RTC_CLK); void loop() myRTC.updateTime()
#include <virtuabotixRTC.h> virtuabotixRTC myRTC(2, 3, 4); const int relayPin = 7; void setup() pinMode(relayPin, OUTPUT);