Hello folks !
I'm testing the functionality of my function findDateHour (). This functions reads a JSON which contains the values of day,hour,minute and seconds. And it should store them within *schedule. I made a DateTime type variable which will have those values. Let's go for the coding.
// Function that reads characters and stops when the declared char is found.
void ReadCaracter (char c, File file) {
char caracter;
while (file.available()) {
caracter = file.read();
if (caracter == c) break;
}
void findDateHour(Schedules *schedule) {
int dayy, hourr, minutes, seconds;
int monthh = 12; int yearr = 2016;
LeCaracter(':', file);
dayy = ((file.read() - 48));
Serial.print("Day : ");
Serial.println(dayy);
ReadCaracter(':', file);
ReadCaracter('"', file);
hourr = ((file.read() - 48) * 10);
hourr = hourr + ((file.read() - 48));
Serial.print("Hour : ");
Serial.println(hourr);
ReadCaracter(':', file);
minutes = ((file.read() - 48) * 10);
minutes = minutes + ((file.read() - 48));
Serial.print("Minutes : ");
Serial.println(minutes);
ReadCaracter(':', file);
seconds = ((file.read() - 48) * 10);
seconds = seconds + ((file.read() - 48));
Serial.print("Seconds : ");
Serial.println(seconds);
// Creates dateTime variable
DateTime date = DateTime(yearr, monthh, dayy, hourr, minutes, seconds);
schedule->setHourSchedule(date);
}
}
So my question is, i want to print in the serial the getHourSchedule(), but Serial.println(schedule->getHourSchedule()); is not working. How should I do then?
Schedules.h
class Schedules
{
public:
void setHourSchedule(DateTime hourSchedule);
DateTime getHoraAgendamento();
private :
DateTime hourSchedule;
};
Schedules.cpp
void Scheduless::setHourSchedule(DateTime data){
hourSchedule = data;
}
DateTime Schedules::getHourSchedule(){
return hourSchedule;
}
Thanks in advance,
Rezik