hi umer,
Downloaded your file. will check, I do not have an OLED.
Look at this option,no buttons, no OLED, needs a little tidy up, it works.
To use:
The Serial0 port input: Tyyyy,mm,dd,hh,mm,ss , will set the RTC and give a Set Time reply
E
Downloaded your file. will check, I do not have an OLED.
Look at this option,no buttons, no OLED, needs a little tidy up, it works.
To use:
The Serial0 port input: Tyyyy,mm,dd,hh,mm,ss , will set the RTC and give a Set Time reply
E
C-like:
/// Serial0
if (stringComplete0){
strID0=(dataString0.substring(0,1));
//Serial.println("Ser0");
if (strID0 == "$"){
Serial.print(dataString0);
File dataFile = SD.open("datalog.txt", FILE_WRITE);
// if the file is available, write to it:
if (dataFile) {
dataFile.print(dt);
dataFile.print(" ");
dataFile.print(tm);
dataFile.print(msec);
dataFile.print(",");
dataFile.print(dataString1);
dataFile.close();
} else {
Serial.println("error opening datalog.txt");
} }
// clear the string:
// Expected DateTime String= T2011,06,18,08,52,30
//
if (strID0 == "T"){
String strYear=(dataString0.substring(1,5));
int myYear = strYear.toInt();
String strMonth=(dataString0.substring(6,8));
int myMonth = strMonth.toInt();
String strDay=(dataString0.substring(9,11));
int myDay = strDay.toInt();
String strHour=(dataString0.substring(12,14));
int myHour = strHour.toInt();
String strMin=(dataString0.substring(15,17));
int myMin = strMin.toInt();
String strSec=(dataString0.substring(18,20));
int mySec = strSec.toInt();
rtc.adjust(DateTime(myYear,myMonth,myDay,myHour,myMin,mySec));
strID0="";
}
//Date Time Check
DateTime now = rtc.now();
Serial.print (now.year());
Serial.print (now.month());
Serial.println (now.day());
Serial.print (now.hour());
Serial.print (now.minute());
Serial.println (now.second());
dataString0 = "";
stringComplete0 = false;
strID0="";
}