26-12-2021, 15:45
(26-12-2021, 14:28)kaczakat napisał(a): Zastosowany uC nie ma znaczenia, zerowanie czasu odbywa się bo:Hej. Bateria ma poprawne napięcie. Testowałem też z 18650. Bibliotekę załączyłem a to cześć kodu:
a) robi to program, którego kodu nie pokazujesz.
b) bateria nie podtrzymuje działania RTC.
Kod:
#include <virtuabotixRTC.h> //|
//|
//=======================================================================================================//|
// //|
// Include files required for Program Function End //|
// //|
//=======================================================================================================//|
// Creation of the Real Time Clock Object
virtuabotixRTC myRTC(6, 7, 8);
void setup() {
Serial.begin(9600);
// Set the current date, and time in the following format:
// seconds, minutes, hours, day of the week, day of the month, month, year
myRTC.setDS1302Time(00, 59, 23, 6, 10, 1, 2014);
}
//=======================================================================================================//|
// //|
// Printout by accessing Single Element objects BEGIN //|
// //|
//=======================================================================================================//|
// //|
// This example utilizes the Serial.print function to access individual data elements, this allows for //|
// user defined output format. //|
// //|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//|
void loop() { //|
// This allows for the update of variables for time or accessing the individual elements. //|
myRTC.updateTime(); //|
//|
// Start printing elements as individuals //|
Serial.print("Current Date / Time: "); //|
Serial.print(myRTC.dayofmonth); //|
Serial.print("/"); //|
Serial.print(myRTC.month); //|
Serial.print("/"); //|
Serial.print(myRTC.year); //|
Serial.print(" "); //|
Serial.print(myRTC.hours); //|
Serial.print(":"); //|
Serial.print(myRTC.minutes); //|
Serial.print(":"); //|
Serial.println(myRTC.seconds); //|
//|
// Delay so the program doesn't print non-stop //|
delay( 5000); //|
}
Sprawdzę jeszcze na "gołym" układzie bez innych elementów.