Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AWS MQTT Connection in a program #306

Open
reddy9698 opened this issue Jul 6, 2022 · 0 comments
Open

AWS MQTT Connection in a program #306

reddy9698 opened this issue Jul 6, 2022 · 0 comments

Comments

@reddy9698
Copy link

reddy9698 commented Jul 6, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant