1

I have GSM shield (and Arduino UNO) works fine with this code :

#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <Suli.h>

#define PIN_TX    7
#define PIN_RX    8
#define BAUDRATE  9600

#define MESSAGE_LENGTH 160
char message[MESSAGE_LENGTH];
int messageIndex = 0;

char phone[16];
char datetime[24];

GPRS gprsTest(PIN_TX,PIN_RX,BAUDRATE);//RX,TX,PWR,BaudRate

void setup() {
  Serial.begin(9600);
  while(0 != gprsTest.init()) {
      delay(1000);
      Serial.print("init error\r\n");
  }
  delay(3000);  
  Serial.println("Init Success, please send SMS message to me!");
}

void loop() {
   messageIndex = gprsTest.isSMSunread();
   if (messageIndex > 0) { //At least, there is one UNREAD SMS
      gprsTest.readSMS(messageIndex, message, MESSAGE_LENGTH, phone, datetime);           
      //In order not to full SIM Memory, is better to delete it
      gprsTest.deleteSMS(messageIndex);
      Serial.print("From number: ");
      Serial.println(phone);  
      Serial.print("Datetime: ");
      Serial.println(datetime);        
      Serial.print("Recieved Message: ");
      Serial.println(message);   
      String msassages = message;
        if(msassages == "Hello"){
          gprsTest.sendSMS(phone,"hello to you");
        }
   }
}

After adding #include <TinyGPS.h> ; it works fine too but after adding TinyGPS gps; (and nothing else) to the code header, everything stop working and i can't see anything in terminal and the program stop sending SMS back. I should mention , TinyGPS works fine individually.

Why this happen ?

  • 1
    Check how much memory if free. Is there memory enough for the TinyGPS as well? Reduce memory usage by using F() for all string literals. Reduce the buffer size, etc. – Mikael Patel Mar 6 '16 at 15:31

Your Answer

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

Browse other questions tagged or ask your own question.