Yes , I tried it out again and found that it is now working, it’s now capable of giving me the actual location . But I have been trying to use the functions to send sms but not working.
I’m still checking it up to see how I can use the SMS function.
Good day Sir, please I have tried something out here using the AT command. It says successful but I don’t receive any message. I believe I miss some code . Find it below please
#include "mbed.h"
#define GSM_DEFAULT_BAUD_RATE 115200
UARTSerial *_serial;
ATCmdParser *_parser;
DigitalOut RST(D3, 1); //POWERKEY
DigitalIn AN(D4); //STAT
int main()
{
printf("\nATCmdParser");
printf("Trying to power up the module!\n");
while (AN.read() == 0)
{
printf("Trying to power up!\n");
RST.write(0);
wait(1.5);
RST.write(1);
wait(2);
}
printf("Modul is powered!\n");
_serial = new UARTSerial(D8, D2, GSM_DEFAULT_BAUD_RATE);
_parser = new ATCmdParser(_serial);
_parser->debug_on( 1 );
_parser->set_delimiter( "\r\n" );
_parser->send("AT+CMGF=1");
wait(1);
_parser->send("AT+CSMP?");
while (1){
wait(2);
_parser->send(" AT+CMGS='+233556128170'> Hello Wrld <Ctrl+Z>");
if( _parser->recv("OK")){
printf("\nATCmdParser: Message was sent successfully");
} else {
printf("\nATCmdParser: Message was not sent");
}
wait(3);
}
}
Sir please, Kindly find attached the link to all files of the above code. I have tried to used some of the SMS handling function to send the SMS but still not working. I’m sure I’m missing something, could you please check and see how we can go about the GSM using those SMS functions in the library ?
By the way the GPS is working . GSM-GPS code
I already check it but you need a correct sequence of functions. And I not found an documentation for that.
The library probably is rework of this one.
I don’t know how far you are right now, but for easeally play with AT commands you can try code bellow.
Code
#include "mbed.h"
#define GSM_DEFAULT_BAUD_RATE 115200
UARTSerial *_serial;
ATCmdParser *_parser;
DigitalOut RST(D3, 1); //POWERKEY
DigitalIn AN(D4); //STAT
int main()
{
printf("\nATCmdParser");
printf("Trying to power up the module!\n");
while (AN.read() == 0)
{
printf("Trying to power up!\n");
RST.write(0);
wait(1.5);
RST.write(1);
wait(2);
}
printf("Modul is powered!\n");
_serial = new UARTSerial(D8, D2, GSM_DEFAULT_BAUD_RATE);
_parser = new ATCmdParser(_serial);
_parser->debug_on( 1 );
_parser->set_delimiter( "\r\n" );
char inBuffer[50],response[200];
while(1){
scanf("%s[^\n]",inBuffer);
_parser->send("%s",inBuffer);
_parser->read(response, sizeof(response));
printf("Response: %s\n",response);
memset (inBuffer,0,sizeof(inBuffer));
memset (response,0,sizeof(response));
}
}
With this code you can try to type some At commands via PC terminal and you are receiving response in a moment.So you will not need recompile the program for every change in At commands sequence or settings.
Hello Sir
I do appreciate your help, I have been trying over and over to send the SMS but with no good response. Wanted to try more possibilities before coming back to you again.
Thanks a lot , will try out your code as well.
Will surely come back .
Good day Sir
Trust you are doing good .
Please I have written this code below. The SMS part runned well when the sim808 was detected but , haven’t received any message. So I decided to check the status of the network, and found out that my sim card does not really connect to the network. Is there a way to activate the sim card so it connects to the network ?
Since the code worked but did not receive any message, I decided to check the status of the network and I got 4 and later 2 from this code line pc.printf(“N: %zu”, n); So per arduino code below (which is part of one of the link you gave me )
if (n == 0) Serial.println(F(“Not registered”));
if (n == 1) Serial.println(F(“Registered (home)”));
if (n == 2) Serial.println(F(“Not registered (searching)”));
if (n == 3) Serial.println(F(“Denied”));
if (n == 4) Serial.println(F(“Unknown”));
if (n == 5) Serial.println(F(“Registered roaming”));
break;
4 : Means Unknown and 2: Not registered . So I concluded that my SIM CARD is not connecting to network . So was wondering if we there is a way to activate it B4 I can send my message.
Hello Sir , please it has finally worked , yesterday when I tried it . And that is exactly what you said , I gave it time to establish the connection then I used the SendSMS function to send the message and it was successful. I’m very grateful SIR for everything you have done. Thanks a million
But still not yet finished , Want now to retrieve missed calls numbers . that is the next challenge currently.
Will keep you inform please
Ooh ok , thank you Sir .
So what will be the result if we print out the variable hi ? And what does variable lo becomes ? We don’t use it anymore ? . Still wondering how the conversion takes place with all these variable ?
Or which one of the variable can be considered as the real converted value of our unint16_t variable ?