ReceiveSMS

Hello kind people!
I’m very new to Arduino. I have been trying to use the ready made code from Arduino library to receive an sms, but up to no avail.
The serial monitor displays only:

SMS Messages Receiver
GSM initialized
Waiting for messages

I am using SIM900 v2.0 connected to Arduino/Funduino UNO and I think that I have a good network conection as the green LED blinks every 3 seconds as it should. I have sent sms numerous to it, but theyare never received. The code compiles very well and I do not have error in it.
The code is:

/*
SMS receiver

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

Circuit:

  • 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:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial.println(“SMS Messages Receiver”);

// connection state
boolean notConnected = false;

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

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);
Serial.println(senderNumber);

// An example of message disposal
// Any messages starting with # should be discarded
if (sms.peek() == ‘#’) {
Serial.println(“Discarded SMS”);
sms.flush();
}

// Read message bytes and print them
while (c = sms.read()) {
Serial.print(c);
}

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

// Delete message from modem memory
sms.flush();
Serial.println(“MESSAGE DELETED”);
}

delay(1000);

}

Does anyone have a clue as to why I am no receiving any sms.

I will deeply appreciate your reply.

Thank you in advance.

mazimum

You have posted code without using code tags. This creates certain problems and obstacles for other forum members. The code tags make the code look

like this

when posting source code files. It makes it easier to read, and can be copied with a single mouse click.
If you have already posted without using code tags, open your message and select “modify” from the pull down menu labelled, “More”, at the lower left corner of the message. Highlight your code by selecting it (it turns blue), and then click on the “</>” icon at the upper left hand corner. Click on the “Save” button. Code tags can also be inserted manually in the forum text using the [code] and [/code] metatags.

When you are finished that, please read these two posts:

How to use this forum - please read.
and
Read this before posting a programming question …

In this case, you could have just linked to the code.