Click here to Skip to main content
14,452,742 members
Rate this:
Please Sign up or sign in to vote.
See more:
i want to execute the AT command in application.i don't want to enter by user
phone numbner is saved in structure variable.how to assign to this to

"AT+CMGS = "973898045674"

but my number is in structure variable

and my text message also in buffer
msg_format = "host_name,1:azure_cloud"

how can i execute this command ?

What I have tried:

i tried like this
AT+CMGS = <structurevariable> <messagebuffername>
but it is not working
Posted
Updated 13-Dec-19 2:53am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

All you have to do is create a suitably sized array of characters - 26 to hold AT+CMGS="973898045674" including the terminating newline and null, then copy in three parts using strcpy:
AT+CMGS="       - A fixed string
973898045674    - the number to send it to from your struct
"\n             - the terminating close quote and the "GO" instruction
The modem will then send back four characters as a prompt ready for the message body.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100