I'm using an Arduino shield connected to an Arduino Uno for sending text messages. I'm using one of the in built examples from the Arduino IDE for sending SMS by name - sendsms in the GSM examples. However, the code doesnt work at all... it keeps hanging at the line

if (gsmAccess.begin(PINNUMBER) == GSM_READY)

and never goes beyond it.

I didn't keep any pincode for my SIM card. please help

Screenshot of code

  • 2
    Post your code properly. Does the shield show any sign that it is on, like a blinking LED? Do you have a SIM attached? – SoreDakeNoKoto Feb 9 '16 at 14:55
  • 1
    ...and please summarize your problem in the title. Success. – Arjan Feb 9 '16 at 18:31

Try this sketch:

#include <SoftwareSerial.h>

SoftwareSerial gsm(2,3);
void setup() {

void loop() {
  // put your main code here, to run repeatedly:
  while (gsm.available() > 0)
  while (Serial.available() > 0)

This sketch will help troubleshoot exactly what's wrong with your setup, without the clutter of a library.

Connect the shield's TX pin to Arduino pin 2 and the shield's RX pin to Arduino pin 3. Ensure that all GNDs are connected. Upload the sketch. Set your serial monitor to BOTH NL & CR and the baud rate to 9600. Enter AT from the serial monitor. If you recieve OK, it means comms have been established with the shield. If you receive gibberish, change the SoftwareSerial baud rate to values from 19200, 57600, etc. until you get a legible response.

Then send the command AT+CREG? to check the SIM's registration status. If you get something like +CREG: *, 1 or +CREG: *, 5 (* means 'dont care'), then your SIM has been registered on the network. Report your results here.

| improve this answer | |

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.