Start a new topic

RTC Problems

Below is what I get from the serial monitor. The "Sunday" lines are correct. any idea why I am getting this extra data?


7.Wednesday 03.01.2011 -- 03:20:12
Sunday 07.03.2016 -- 06:35:29
Sunday 07.03.2016 -- 06:35:41
7.03.2016 41.40.2005 -- 01:13:54
Sunday 07.03.2016 -- 06:36:03
Wednesday 03.01.2011 -- 03:21:10
Sunday 07.03.2016 -- 06:36:25
7.03.2016 60.60.2002 -- 12:46:46
Sunday 07.03.2016 -- 06:36:47
Sunday 07.03.2016 -- 06:36:59
Wednesday 03.01.2011 -- 03:21:08
Sunday 07.03.2016 -- 06:37:21
7.03.2016 41.40.2005 -- 01:13:52
Sunday 07.03.2016 -- 06:37:43
Wednesday 03.01.2011 -- 03:21:30



//My Sketch

/*
Required library - http://www.rinkydinkelectronics.com/library.php?id=5
Blog Post - http://overskill.alexshu.com/ds1302-real-time-clock-w-arduino/
*/

#include <DS1302.h>
#include <SoftwareSerial.h>
#include <Nextion.h>

//Nextion Code
SoftwareSerial nextion(10, 11);// Nextion TX to pin 10 and RX to pin 11 of Arduino
Nextion myNextion(nextion, 9600); //create a Nextion object named myNextion using the nextion serial port @ 9600bps

// Init the DS1302
DS1302 rtc(49, 51, 53);  // Change the pins here if you want

void setup()
{
// Set the clock to run-mode, and disable the write protection
rtc.halt(false);
rtc.writeProtect(false);

// Setup Serial connection
Serial.begin(9600);

// The following lines can be commented out to use the values already stored in the DS1302
// Once you flash the arduino with the correct time.

//rtc.setDOW(SUNDAY); // Set Day-of-Week to SUNDAY (IN CAPS)
//rtc.setTime(6,30, 0); // Set the time to 12:00:00 (24hr format) (12,27, 0)
//rtc.setDate(7, 3, 2016); // Set the date to July 3rd, 2016
}
void loop()
{
 
// Send Day-of-Week
Serial.print(rtc.getDOWStr());
Serial.print(" ");

// Send date
Serial.print(rtc.getDateStr());
Serial.print(" -- ");

// Send time
Serial.println(rtc.getTimeStr());

// Wait one second before repeating :)
delay (10000);

myNextion.setComponentText("t0", rtc.getTimeStr()); // Send time
myNextion.setComponentText("t1", rtc.getDOWStr());  // Send Day-of-Week
myNextion.setComponentText("t2", rtc.getDateStr()); // Send date

// Wait one second before repeating :)
delay (1000);
}




thanks



Login or Signup to post a comment