botletics / SIM7000-LTE-Shield

Botletics SIM7000 LTE CAT-M1/NB-IoT Shield for Arduino
https://www.botletics.com/products/sim7000-shield
GNU General Public License v3.0
483 stars 215 forks source link

AWS MQTT Connection in a program #306

Open reddy9698 opened 2 years ago

reddy9698 commented 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

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?