Rolaro
February 21, 2017, 10:03am
1
Hi,
My doubt is how to take an AT responde and put it into a variable.
I send a AT command to syncronise the Arduino with a NTP server.
Then I ask the hour with AT+CCLK?, and I receive a responde like:
+CCLK: "17/02/21,10:57:47+04"
I want to take the date : ""17/02/21,10:57:47+04"" and put into a char or string.
How can i do it?
I'm using an GPRS shield based on a SIM900.
system
February 21, 2017, 11:01am
2
How can i do it?
Use Serial.available() and Serial.read(), if your device is connected to the Serial pins.
Rolaro
February 22, 2017, 8:38am
3
PaulS:
Use Serial.available() and Serial.read(), if your device is connected to the Serial pins.
I do that: String aux;
SIM900.println("AT+CCLK?");
delay(1000);
if(SIM900.available()){
while(SIM900.available()>0){
aux.concat(SIM900.read());
}
And the answer i get its:
131065844367677675631310131043676776755832344955474850475050444857585155585256434852341310131079751310
I think it could be ASCII? I only have to parse to char?
Rolaro
February 22, 2017, 8:53am
4
Yes, only i had to parse and i have the AT response, thanks!!
system
February 22, 2017, 7:15pm
5
Yes, only i had to parse and i have the AT response
How did you parse that data?
No parsing should have been necessary.
while(SIM900.available()>0)
{
char ltr = SIM900.read();
aux.concat(ltr);
}