receiving sms's via dfrobot shield sim800H

Hi,
I have a few questions about SMS service.
I want shield to receive sms, and if the SMS is send from my number, it should read the message, do something ang delete SMS. If the SMS is send from different number, ignore and delete.
Function from the library doesn't show the phone number, how can I do this with AT commands? Or can I use built-in GSM library?
How can I check, if there is a new SMS?
If there is an incoming SMS, is it automatically stored in memory?
I use Arduino mega 2560 and IDE 1.0.6
Sorry for my questions, I'm a noob.
I have a few questions about SMS service.
I want shield to receive sms, and if the SMS is send from my number, it should read the message, do something ang delete SMS. If the SMS is send from different number, ignore and delete.
Function from the library doesn't show the phone number, how can I do this with AT commands? Or can I use built-in GSM library?
How can I check, if there is a new SMS?
If there is an incoming SMS, is it automatically stored in memory?
I use Arduino mega 2560 and IDE 1.0.6
Sorry for my questions, I'm a noob.
2017-07-08 02:00:50 Thank you for your answer, another problem is recognition of SMS content, my code is:
*******************************************************************************
Ok, it turned out, that recieved massage is also in UCS2 code, and second thing is, that I should read it in main loop, not fundebug2 function.
pawelung
Code: Select all
Of course it doesn't work, but it compiles now. How can I fix it?#include <sim800cmd.h>
Sim800Cmd sim800demo(fundebug);
const int LED=13;
char id[5]={'\0'};
char contents[21]={'\0'};
void setup(){
pinMode(LED, OUTPUT);
while((sim800demo.sim800init())==0);
delay(1000);
sim800demo.setSMSEnablePrompt(OPEN);
sim800demo.setSMSHandlefunction(fundebug2);
delay(1000);
}
void loop(){
}
void fundebug(void){
sim800demo.cancelCall();
}
void fundebug2(void){
sim800demo.getSMSID(id);
sim800demo.readSMS(id,contents);
if(contents=="TURN ON"){
digitalWrite(LED, HIGH);
} else if(contents=="TURN OFF"){
digitalWrite(LED, LOW);
}
sim800demo.deleteSMS(id);
}
*******************************************************************************
Ok, it turned out, that recieved massage is also in UCS2 code, and second thing is, that I should read it in main loop, not fundebug2 function.

2017-07-04 23:47:19 We recently have change the library of this board, please download the latest library, we have use the following code to display the number in serial monitor
robert.chen
Code: Select all
The AT command "AT+CLIP=1\r\n" can show the **. You can download the AT command manual for more functions #include <sim800cmd.h>
//initialize the library instance
//fundebug is an application callback function,when someon is calling.
Sim800Cmd sim800demo(fundebug1);
//** buffer
char str[15] = {'\0'};
//the setup routine runs once when you press reset:
void setup()
{
//initialize the digital pin as an output.
pinMode(13,OUTPUT);
//initialize SIM800H,return 1 when initialize success.
while((sim800demo.sim800init()) == 0);
//enable SIM800H Modular Caller ID
sim800demo.DisplayPhoneNumber(OPEN);
Serial.begin(19200);
}
//the loop routine runs over and over again forever:
void loop()
{
}
//application callback function
//Note that not too much to handle tasks in this function
void fundebug1(void)
{
//get the **
sim800demo.getCallnumber(str);
for(int i=0; i<15; i++)
{
Serial.print(str[i]);
}
Serial.print("\n");
}
