GSM_ARDUINO_CODE

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);
}
no code visible here!

First write a simple program that just sends a SMS with none of the button code and work on that until you can successfully send messages.

Hi,

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

TomGeorge:
Hi,

Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html
then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

I'm Sorry , i will read it now .. Thanks