Open reddy9698 opened 2 years ago
I've been meaning to implement the process mentioned by @davegravy in a code. This is the program that I'm using in the void loop part.
` modem.sendAT("+SMCONN"); if (modem.waitResponse(1000L, res) == 1) { res.replace(GSM_NL "OK" GSM_NL, ""); Serial.println(res); Serial.println("connection!!!!"); }
res="";
modem.sendAT("+SMPUB = \"BasicPubSub\", 425,0,0"); if (modem.waitResponse(10000L, res) == 1) { res.replace(GSM_NL "OK" GSM_NL, ""); Serial.println(res); Serial.println("datssent"); res="";
SerialAT.print(jsonBuffer); }
modem.sendAT("+SMDISC"); if(modem.waitResponse(1000L,res) == 1) { Serial.println(res); res=""; Serial.println("disconnectedf");
} res="";
} `
and this is the message that arrives on the topic on AWS
=================================================== AT+SMCONN AT+SMPUB = "BasicPubSub", 425,0,0 AT+SMDISC AT+SMCONN
AT+SMPUB = "BasicPubSub", 425,0,0
AT+SMDISC
AT+SMCONN
The payload just contains all the previous AT commands entered with the actual payload. What is the mistake that I am doing ? What changes should I be making to the code?
I've been meaning to implement the process mentioned by @davegravy in a code. This is the program that I'm using in the void loop part.
` modem.sendAT("+SMCONN"); if (modem.waitResponse(1000L, res) == 1) { res.replace(GSM_NL "OK" GSM_NL, ""); Serial.println(res); Serial.println("connection!!!!"); }
res="";
modem.sendAT("+SMPUB = \"BasicPubSub\", 425,0,0"); if (modem.waitResponse(10000L, res) == 1) { res.replace(GSM_NL "OK" GSM_NL, ""); Serial.println(res); Serial.println("datssent"); res="";
modem.sendAT("+SMDISC"); if(modem.waitResponse(1000L,res) == 1) { Serial.println(res); res=""; Serial.println("disconnectedf");
} `
and this is the message that arrives on the topic on AWS
=================================================== AT+SMCONN AT+SMPUB = "BasicPubSub", 425,0,0 AT+SMDISC AT+SMCONN
AT+SMPUB = "BasicPubSub", 425,0,0
AT+SMDISC
AT+SMCONN
AT+SMPUB = "BasicPubSub", 425,0,0
AT+SMDISC
AT+SMCONN
AT+SMPUB = "BasicPubSub", 425,0,0
AT+SMDISC
AT+SMC
The payload just contains all the previous AT commands entered with the actual payload. What is the mistake that I am doing ? What changes should I be making to the code?