try gsm lib in mega2560 not work

Try read SMS not work in Arduino mega2560, use pin 10 and 11 (tx,rx). help me please

GPRS_SMSread.ino (1.59 KB)

Please insert your code in the post, not as an attachment. It’s small enough and people with e.g. cell phones will more than likely not be able to view it if it’s attached.

** **[code]** **

Paste your code after that
** **[/code]** **
after that

So it looks like (beryindo’s code, done it for you this time)


This sketch is used to test seeeduino GPRS_Shield's reading SMS 
function.To make it work, you should insert SIM card
to Seeeduino GPRS Shield,enjoy it!

There are two methods to read SMS:
  1. GPRS_LoopHandle.ino  -> in order to recieve "+CMTI: "SM"" 
      may be you need to send this command to your shield: "AT+CNMI=2,2,0,0,0"
  2. GPRS_SMSread.ino -> you have to check if there are any 
      UNREAD sms, and you don't need to check serial data continuosly

create on 2015/05/14, version: 1.0
by op2op2op2(

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

#define PIN_TX    10
#define PIN_RX    11
#define BAUDRATE  9600

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

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


void setup() {
  while(!gprsTest.init()) {
      Serial.print("init error\r\n");
  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
      Serial.print("From number: ");
      Serial.print("Datetime: ");
      Serial.print("Recieved Message: ");

thank you sterretje, can you help for my case ?

Try read SMS not work in Arduino mega2560

You have some undefined external hardware connected in some undefined way to the Arduino. The code that you posted does something that you did not describe. You expect it to do something that you did not describe.

can you help for my case ?

Hardly seems likely, does it?