Get time from Internal Clock (Sara R410M)

Goodmorning,

I would like to get the time from the internal clock, and place it in a local variable.
I found these AT-Commands. By sending the AT-Commands via the serial monitor I figured out that setting the clock works.

Does anyone know how to place the response of the AT-Command AT+CCLK? in a local variable?

Good morning @Alex_Bijmolt,

I’m currently working on processing the return values of AT commands as well. I only want my code to continue if “OK” is returned. The MODEM_STREAM.read() returns a decimal value which can be converted to ASCII. Saving the MODEM_STREAM.read() in a char did the job for me. After that you can do whatever you want with the char. For example look at index numbers to determine hours, minutes, seconds etc…

while (MODEM_STREAM.available())
{
char answer = MODEM_STREAM.read();
DEBUG_STREAM.print(answer);
}

Hmm, that’s not working.
I would like to retrieve the whole reply, not only a char.

Makes sense. I’m trying to figure out a way to append all individual chars into a string now.

Don’t ask me how, but I managed to save all the serial data into a string called Answer in the right format. You could Save answer to a different string and then analyze the indexnumbers for your time data. Answer gets reset after all data has bene received. Hope this helps.

while (MODEM_STREAM.available())
{
char data = MODEM_STREAM.read();
Answer = Answer + data;
}
DEBUG_STREAM.println(Answer);
Answer="";