Anybody here having experience with sending SMS to a GPRS Shield with SIM900 connected to Uno?
I have been trying with two different geeetech.com shields. Receiving appears to be the part not working, because sending SMS or voice is perfectly ok. I have been trying with different codes, but still not receiving SMS. I am using pin 7 and pin 8 for serial connection to Uno. Both module are connected to gnd of course and they are powered from each their 5V ps via Vin.
Below you see the code I'm using.
It should be waiting a SMS call (with a message with either ... #a0 ... or ... #a1 ... ) from the mobile phone and upon receipt reading/converting the SMS message to turn on/off pin 13 of Uno. The only reaction I get is, that the serial monitor on start op the shield, print the word Ready...
The below code looks simple, but do not work. I guess it should work with any GPRS shield with SIM900!
Link to the project: https://www.geeetech.com/wiki/index.php/GPRS_Shield_V2.0#Interface_Function
#include <SoftwareSerial.h>
char inchar; // Will hold the incoming character from the GSM shield
SoftwareSerial SIM900(7,8);
int led = 13;
void setup()
{
Serial.begin(19200);
// set up the digital pins to control
pinMode(led, OUTPUT);
digitalWrite(led, LOW);
// wake up the GSM shield
SIM900.begin(19200);
delay(20000); // give time to log on to network.
SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
SIM900.print("AT+CNMI=2,2,0,0,0\r");
// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(100);
Serial.println("Ready...");
}
void loop()
{
//If a character comes in from the cellular module...
if(SIM900.available() >0)
{
inchar=SIM900.read();
if (inchar=='#')
{
delay(10);
inchar=SIM900.read();
if (inchar=='a')
{
delay(10);
inchar=SIM900.read();
if (inchar=='0')
{
digitalWrite(led, LOW);
}
else if (inchar=='1')
{
digitalWrite(led, HIGH);
}
delay(10);
SIM900.println("AT+CMGD=1,4"); // delete all SMS
}
}
}
}