I'm trying to run get query on arduino.
here are my code.
#include <RBD_Timer.h> // https://github.com/alextaujenis/RBD_Timer
RBD::Timer timer(500);
int cnt = -1;
const String webURL = "https://webhook.site/457acaa4-ea36-459a-a8c8-b275a21a5df2";
void setup(){
delay(2000);
Serial.begin(9600);
Serial.setTimeout(100);
delay(10);
Serial1.begin(115200);
delay(10);
issueCommand("ATI");
}
void loop(){
String command = "";
readSerial();
while(Serial.available())
{
command = Serial.readStringUntil('\n');
issueCommand(command);
}
if(timer.onRestart()){cnt++;operation();}
}
void issueCommand(String msg){
Serial1.println(msg);
delay(10);
}
void readSerial(){
while (Serial1.available()){
Serial.write(Serial1.read());
timer.restart();
}
}
void operation()
{
if (cnt == 0){issueCommand("AT+QIDEACT=1");}
else if (cnt == 1){issueCommand("AT+QIACT?");}
else if (cnt == 2){issueCommand("AT+QICSGP=1,1,\"internet\",\"\",\"\" ,3");}
else if (cnt == 3){issueCommand("AT+QIACT?");}
else if (cnt == 4){issueCommand("AT+QIACT=1");}
else if (cnt == 5){issueCommand("AT+QIACT?");}
else if (cnt == 6){issueCommand("AT+QHTTPURL="+String(webURL.length())+",80");}
else if (cnt == 7){issueCommand(webURL);} //https://webhook.site/457acaa4-ea36-459a-a8c8-b275a21a5df2
else if (cnt == 8){issueCommand("AT+QHTTPGET=80");timer.setTimeout(3000);}
else if (cnt == 9){issueCommand("AT+QHTTPREAD=80");}
}
I'm running these code in sequence. Each line send the AT codes to QUECTEL from Serial1 at 115200 baudrate. There is a 500ms wait on most of the AT codes but after get I increased it to 3000ms.
Here is my response on Serial monitor
OK
AT+QIDEACT=1
OK
AT+QIACT?
OK
AT+QICSGP=1,1,"internet","","" ,3
OK
AT+QIACT?
OK
AT+QIACT=1
OK
AT+QIACT?
+QIACT: 1,1,1,"172.30.138.99"
OK
AT+QHTTPURL=57,80
CONNECT
OK
AT+QHTTPGET=80
OK
+QHTTPGET: 0,200
AT+QHTTPREAD=80
CONNECT
A1234567890,B1234567890,C1234567890,567890
OK
+QHTTPREAD: 0
As you see on the response line I got;
A1234567890,B1234567890,C1234567890,567890
but it has to be;
A1234567890,B1234567890,C1234567890,D1234567890,E1234567890
Everytime I did the query the response changes. Here it is...
AT+QHTTPGET=80
OK
+QHTTPGET: 0,200
AT+QHTTPREAD=80
CONNECT
A1234567890,B1234567890,C1234567890,4567890,E1234567890
OK
+QHTTPREAD: 0
Here again another...
+QHTTPGET: 0,200
AT+QHTTPREAD=80
CONNECT
A1234567890,B1234567890,C1234567890,90,E1234567890
OK
+QHTTPREAD: 0
If I done the query over PowerShell , there were no problems...
What is the key?