How to pass data destined to console to a char array in Ardu
Posted: Sat May 16, 2020 12:50 pm
In a sketch that uses RTC on Arduino I have the following pieces of code:
And with this print the RTC reading on the console:
How can I do so that I send to the console is also stored in a char array?
Code: Select all
// print time to Serial
void printTime(time_t t){
printI00(hour(t), ':');
printI00(minute(t), ':');
printI00(second(t), ' ');
}
// print date to Serial
void printDate(time_t t){
printI00(day(t), 0);
Serial << monthShortStr(month(t)) << _DEC(year(t));
}
And with this print the RTC reading on the console:
Code: Select all
void printDateTime(time_t t) {
printDate(t);
Serial << ' ';
printTime(t);
}
How can I do so that I send to the console is also stored in a char array?
Code: Select all
char bufferMSGtoClient[100];