Hello if anyone can help me solve this problem. Im trying out a new library for a DS3234 on a mega. The library has no examples to use and Im pulling my hair out. The function I want to call is to set the date time.
#include <DS3234.h>
#include <SPI.h>
int d = 22;
int mo = 3;
int y = 22;
int h = 19;
int mi = 15;
int s = 0;
void setup() {
// put your setup code here, to run once:
RTC.configure(51,52,50,53);
SPI.begin();
Serial.begin(9600);
RTC.setDateTime();
}
void loop() {
// put your main code here, to run repeatedly:
RTC.readDateTime();
Serial.print("Time: ") ;
if(RTC.time_h()>12){
Serial.print(RTC.time_h()-12);
Serial.print(":") ;
if(RTC.time_m() < 10)
Serial.print("0");
Serial.print(RTC.time_m()) ;
Serial.print(":") ;
if(RTC.time_s() < 10)
Serial.print("0");
Serial.print(RTC.time_s()) ;
Serial.println(" P.M.");
}
else if(RTC.time_h()<12){
Serial.print(RTC.time_h());
Serial.print(":");
if(RTC.time_m() < 10)
Serial.print("0");
Serial.print(RTC.time_m()) ;
Serial.print(":") ;
if(RTC.time_s() < 10)
Serial.print("0");
Serial.print(RTC.time_s()) ;
Serial.println(" A.M.");
}
Serial.print(RTC.readDateTime());
// else if(Serial.print(RTC.time_h())){
// Serial.print(":");
// if(RTC.time_m() < 10)
// Serial.print("0");
// Serial.print(RTC.time_m()) ;
// Serial.print(":") ;
// if(RTC.time_s() < 10)
// Serial.print("0");
// Serial.print(RTC.time_s()) ;
// Serial.println(" P.M.");
//}
// Serial.print("Date: ") ;
// Serial.print(RTC.date_m()) ;
// Serial.print("/") ;
// Serial.print(RTC.date_d()) ;
// Serial.print("/") ;
// Serial.println(RTC.date_y()) ;
delay(2000);
}
The error that im getting is
Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Jesse\Documents\Arduino\MyReefController\MyReefController.ino: In function 'void setup()':
MyReefController:19:18: error: no matching function for call to 'DS3234::setDateTime()'
RTC.setDateTime();
^
In file included from C:\Users\Jesse\Documents\Arduino\MyReefController\MyReefController.ino:1:0:
C:\Users\Jesse\Documents\Arduino\libraries\DS3234-master/DS3234.h:8:8: note: candidate: void DS3234::setDateTime(int, int, int, int, int, int)
void setDateTime(int d, int mo, int y, int h, int mi, int s);
^~~~~~~~~~~
C:\Users\Jesse\Documents\Arduino\libraries\DS3234-master/DS3234.h:8:8: note: candidate expects 6 arguments, 0 provided
exit status 1
no matching function for call to 'DS3234::setDateTime()'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
The Library that Im using is found at
GitHub - OSBSS/DS3234: Used to Sync time in OSBSS dataloggers
Real simple solution im sure but i can not find the answer. Thank you all for help.