GSM library

I'm trying to use GSM library for reading SMS but I can't connect SIM900 to it.I would like to use hardware serial for comunication at 9600 baud rate.I found some examples in GSM library but I don't know how to connect SIM900 to it.

 SMS receiver

 This sketch, for the Arduino GSM shield, waits for a SMS message
 and displays it through the Serial port.

 * GSM shield attached to and Arduino
 * SIM card that can receive SMS messages

 created 25 Feb 2012
 by Javier Zorzano / TD

 This example is in the public domain.


// include the GSM library
#include <GSM.h>

// PIN Number for the SIM
#define PINNUMBER ""

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup() {
  // initialize serial communications and wait for port to open:
pinMode(PD2, OUTPUT);
digitalWrite(PD2, HIGH);
digitalWrite(PD2, LOW); //turn on SIM900
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only

  Serial.println("SMS Messages Receiver");

  // connection state
  boolean notConnected = true;

  // Start GSM connection
  while (notConnected) {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
      notConnected = false;
    } else {
      Serial.println("Not connected");

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");

void loop() {
  char c;

  // If there are any SMSs available()
  if (sms.available()) {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);

    // An example of message disposal
    // Any messages starting with # should be discarded
    if (sms.peek() == '#') {
      Serial.println("Discarded SMS");

    // Read message bytes and print them
    while (c = {

    Serial.println("\nEND OF MESSAGE");

    // Delete message from modem memory
    Serial.println("MESSAGE DELETED");



The GSM library is for the Arduino GSM shield. If you want to use it, get the right hardware.

Okay,I assume library uses software serial.Can anyone tell me what pins are used as TX and RX

According to this page it's pins 2 & 3.

Just asking,is it possible to edit original library to use it with hardware serial? I only need to be able to parse SMS on sender's number and SMS content

It may be as simple as that but the different chip manufacturers embed their own instructions. I cannot be bothered going through the different libraries but if the one for the Arduino shield uses commands specific to the Quectel M10 then you're stuffed.