hello , how are you .. i need your help for GSM module i bought it and i tried to run it with arduino i used the example in arduino ide but it didn't work , i don't know what's the problem because this is the first time using GSM module , i used sim 900 and i searched on the youtube i found the code to send a sms when the state of the pin changed .. no errors in the code, but no message ,, nothing please help me as you can i need to finish this project ...
this is the code ::
#include <SoftwareSerial.h>
SoftwareSerial GPRS(2,3);
boolean state, laststate;
void setup()
{
pinMode(7,INPUT_PULLUP);
state=digitalRead(7);
laststate=state;
GPRS.begin(9600);
Serial.begin(9600);
GPRS.println("AT");
delay(1000);
}
void loop()
{
while (GPRS.available()){
Serial.write(GPRS.read());
}
laststate=state;
state=digitalRead(7);
if (state != laststate){
sendSMS();
}
delay(500);
}
void sendSMS()
{
Serial.print("Switch was turned ");
Serial.println(state ? "on" : "off");
GPRS.println("AT+CMGF=\"+201155662747\"");
delay(500);
GPRS.print("Switch was turned");
GPRS.println(state ? "on" : "off" );
GPRS.write(0x1a);
delay(500);
}