Hi there,
I'm trying to test my new Arduino UNO with DS1302 Module (the green-brown module), but I got some strange readings from the Serial monitor.
I got double DATE reading without TIME.
Used RTC Library can be found here.
Used RTC Module:
#include <DS1302.h>
DS1302 RTC(2, 3, 4);
char RTCBuff[34];
void setup() {
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
RTC.halt(false);
RTC.writeProtect(false);
Serial.begin(9600);
//RTC.setDOW(6); // Set Day-of-Week format SATURDAY or 6
//RTC.setTime(22, 44, 0); // Set the time format 00:00:00
//RTC.setDate(4, 7, 2015); // Set the date format dd.mm.yyyy
}
void loop() {
// Show Day, Date, Time
sprintf(RTCBuff, "%s, %s, %s", RTC.getDOWStr(), RTC.getDateStr(), RTC.getTimeStr());
Serial.println(RTCBuff);
memset(RTCBuff, 0, sizeof(RTCBuff)); // Clear RTCBuff Buffer
delay(1000);
Serial.flush();
}
Can someone help me out, what is wrong with my code?!
Thanks!