Hi all
I am at a complete loss. I have pasted the code in below but cannot figure out why the character arrays are not storing values.
char cAT1[6];
char cAT2[6];
while ((strcmp(cAT1,“AT+CCL”) != 0) || (strcmp(cAT2,“CCLK:”) != 0)){
sBuffer = time_request();
Serial.println(sBuffer);
for (int i = 0; i <= 6; i++){
cAT1 = sBuffer*; // there is a website bug here, this line should have a i between brackets after sBuffer*
* if (i == 6) cAT1[6] = ‘\0’;*
* }*
* Serial.print("AT1 = ");*
* Serial.println(cAT1);*
* Serial.print("AT2 = ");*
* Serial.println(cAT2);*
* for (int i = 0; i <= 6; i++){*
_ cAT2 = sBuffer[i+11];
* if (i == 6) cAT2[6] = ‘\0’;
}*_
* Serial.print("AT1 = ");*
* Serial.println(cAT1);*
* Serial.print("AT2 = ");*
* Serial.println(cAT2);*
* Serial.println(“End--------------------”);*
* }*
Now the response that I get is the following:
AT+CCLK?
+CCLK: “04/01/01,00:17:25+08”
OK
AT1 = AT+CCL
AT2 =
AT1 =
AT2 = +CCLK:
End--------------------
As you can see, for some unknown reason, AT1 is rewritten after i run the second for loop.
Any help would be massively appreciated.