Page 3 of 3

Re: Is there a Library available for using a Real Time Clock shield

Posted: 27 Aug 2024 15:37
by KGBEl
Hi, I will order one and try.

Where can I find info about how to connect to Z-Uno?

Will I use only 3.3V or both?

Re: Is there a Library available for using a Real Time Clock shield

Posted: 27 Aug 2024 15:50
by KGBEl
I mean, on the CP2102, will I use only 3.3V or both 3.3 and 5V.

Re: Is there a Library available for using a Real Time Clock shield

Posted: 27 Aug 2024 17:57
by KGBEl
Sorry for this inconvenience.
After changing the code a bit it worked just fine.

Code: Select all

#include "Arduino.h"
//#include "Wire.h"
#include <ZUNO_DS3232RTC.h>
#include <Time.h>


#define MY_SERIAL Serial


DS3232RTC myRTC;

tmElements_t te, te_r;

time_t ts; // secs since 1900.

void setup() {
	MY_SERIAL.begin(9600);
	te.Second = 30;
	te.Minute = 32;
	te.Hour = 13;
	te.Wday = 6;
	te.Day = 8;
	te.Month = 6-1;
	te.Year = 2024 -1900;
	myRTC.write(&te);
}

void loop() {
	if (myRTC.read(&te_r) != 0 /*WIRE_ERORR_TRANSMISSION_SUCCESS*/) {
		MY_SERIAL.print("myRTC.read - error\n");
	}
	disp();
	delay(10000);
}

void disp(void){
	MY_SERIAL.print("dump: ");
	MY_SERIAL.dumpPrint(&te_r, sizeof(te_r), sizeof(te_r));
	MY_SERIAL.printf("\n*************\n%04d-%02d-%02d %02d:%02d:%02d : Weekday = %d.\n", te_r.Year + 1900, te_r.Month + 1, te_r.Day, te_r.Hour, te_r.Minute, te_r.Second, te_r.Wday);
}
and made this output:

Code: Select all


�myRTC.read - error
dump: 1E 20 0D 06 08 05 7C

*************
2024-06-08 13:32:30 : Weekday = 6.
myRTC.read - error
dump: 28 20 0D 06 08 05 7C

*************
2024-06-08 13:32:40 : Weekday = 6.
myRTC.read - error
dump: 32 20 0D 06 08 05 7C

*************
2024-06-08 13:32:50 : Weekday = 6.
dump: 00 21 0D 06 08 05 7C

*************
2024-06-08 13:33:00 : Weekday = 6.
myRTC.read - error
dump: 2B 0D 06 00 05 0E 7C

*************
2024-15-05 06:13:43 : Weekday = 0.
myRTC.read - error
dump: 35 0D 06 00 05 0E 7C

*************


Is that what you wanted?

Re: Is there a Library available for using a Real Time Clock shield

Posted: 13 Sep 2024 16:09
by KGBEl
Is it what you asked for?