hello
I have a problem with SIM900 GPRS SHIELD …
I want you to read the incoming SMS shield. I want to read the sms text and put it into a variable.
I can not …
have libraries to recommend?
here is a sample code, how can I make readsms?
[code]
#include <SoftwareSerial.h>
#include <String.h>
#include <leOS.h>
SoftwareSerial mySerial(7, 8);
int ledcontrollo = 13; //led di controllo stato sensore PIR
int sen = 10; //porta sensore PIR
int allarme = 0; //variabile di controllo attivazione/disattivazione allarme
void setup()
{
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(3000);
mySerial.begin(19200); //inizializzazione shield gprs
pinMode(sen, INPUT); //pin di input sensore PIR
pinMode(ledcontrollo, OUTPUT);
delay(500);
}
void loop()
{
if (digitalRead(sen) == HIGH){
digitalWrite(ledcontrollo, HIGH);
DialVoiceCall(); }
else{
digitalWrite(ledcontrollo, LOW);}
}
void SendTextMessage()
{
mySerial.print(“AT+CMGF=1\r”); //Because we want to send the SMS in text mode
delay(100);
mySerial.println("AT + CMGS = “+86138000000"”);//send sms message, be careful need to add a country code before the cellphone number
delay(100);
mySerial.println(“A test message!”);//the content of the message
delay(100);
mySerial.println((char)26);//the ASCII code of the ctrl+z is 26
delay(100);
mySerial.println();
}
void DialVoiceCall()
{
mySerial.println(“ATD + +3930000000;”);//dial the number
delay(100);
mySerial.println();
}
void controllo(){
if (digitalRead(sen) == HIGH){
digitalWrite(ledcontrollo, HIGH);}
else{
digitalWrite(ledcontrollo, LOW);}
}
/code]