0

I have made modification of the code from GSM Modem with Arduino UNO

I have found a related question but it does not solve my problem. The message and command is printed in serial terminal of Arduino IDE but message is not received in the registered number. I am using SIM900A GSM module. Kindly direct me where I have gone wrong.

int pin = 4;
int val = 0; 
void setup()
{
  pinMode(pin, INPUT);   
  Serial.begin(9600);  //Baud rate of the GSM/GPRS Module 
  Serial.print("\r");
  delay(1000);                  
  Serial.print("AT+CMGF=1\r");    
  delay(1000);
  Serial.print("AT+CMGS=\"+919********5\"\r");    
  delay(1000);

}
void loop()
{
  delay(1000);
  val = digitalRead(pin);
  delay(1000);
  if(val==1)
  {
    delay(1000);
    Serial.print("Found an object\r");   
    delay(1000);
    Serial.write(0x1A);
    delay(1000); 
  }
  val=0;
  delay(1000);

 }
  • Could you provide a link to the related question? – Greenonline Apr 28 '15 at 17:49
  • Voting to close as this has been abandoned for over a year without an answerable question ever having been stated. – Chris Stratton Oct 5 '16 at 8:03
  • @Chris true, I believe the personen gave up on the question. Also, looking at the code, it seems to miss all kind of checks for if the device even is connected to a network at all. – Paul Nov 4 '16 at 7:23
1

If you want to use the Console monitor and the GSM at the same time, you need to use different pins to separate the communication streams.

Typically the console serial monitor is attached to Serial.*, while GSM modules are attached using SoftwareSerial to other pins. See https://arduino.stackexchange.com/a/1195/6628 for an example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.