Hello, I am trying the light bulb test using an example sketch from Open-Electronics. The sketch is suppose to retrieve an SMS with commands from the SIm card, and either turn ON/Off the light bulb.
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;
char number[]="27837918186";
char message[180];
char pos;
char *p;
void setup()
{
Serial.println("setup Section");
Serial.begin(9600);
if (gsm.begin(2400))
Serial.println("\nstatus=READY");
else Serial.println("\nstatus=IDLE");
};
void loop()
{
Serial.println("loop Section");
pos=sms.IsSMSPresent(SMS_UNREAD);
Serial.println((int)pos);
if((int)pos>0&&(int)pos<=20){
Serial.print("NUOVO MESSAGGIO, POS=");
Serial.println((int)pos);
message[0]='\0';
sms.GetSMS((int)pos,number,message,180);
p=strstr(message,"testpwd");
if(p){
Serial.println("PSWD OK");
p=strstr(message,"LEDON");
if(p){
Serial.println("LED ON");
digitalWrite(4,HIGH);
}
else{
p=strstr(message,"LEDOFF");
if(p){
Serial.println("LED OFF");
digitalWrite(4,LOW);
}
}
}
sms.DeleteSMS((int)pos);
}
delay(5000);
};
However, when I upload the sketch onto the Arduino, I get this Result.
RIC: NO STRING RCVDATT: OK
RIC: NO STRING RCVDATT: OK
RIC: NO STRING RCVDATT: OK
RIC: NO STRING RCVDATT: OK
RIC:
OK
ATT: +CMGL:
RIC:
OK
0
Please help me figure out what I am doing wrong.
Thank you