Hi! I'm new to the Arduino world aswell as this forum.
Few days ago I got my Arduino Uno and a GSM shield and I have been trying to set it up. I can get the Arduino to work fine and run a blinking program as intended.
Though all the LEDs are blinking proberbly on my shield I never seem to get any sort of response from it when trying to run the sendSmS test program.
Here is my code:
/*
SMS sender
This sketch, for the Arduino GSM shield,sends an SMS message
you enter in the serial monitor. Connect your Arduino with the
GSM shield and SIM card, open the serial monitor, and wait for
the "READY" message to appear in the monitor. Next, type a
message to send and press "return". Make sure the serial
monitor is set to send a newline when you press return.
Circuit:
* GSM shield
* SIM card that can send SMS
created 25 Feb 2012
by Tom Igoe
This example is in the public domain.
http://arduino.cc/en/Tutorial/GSMExamplesSendSMS
*/
// Include the GSM library
#include <GSM.h>
#define PINNUMBER "8025"
// initialize the library instance
GSM gsmAccess(true);
GSM_SMS sms;
void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("SMS Messages Sender");
Serial.println("TEST1");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
Serial.println("TEST2");
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
{
notConnected = false;
Serial.println("TEST3");
}
else
{
Serial.println("TEST4");
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("TEST5");
Serial.println("GSM initialized");
}
void loop()
{
Serial.print("Enter a mobile number: ");
char remoteNum[20]; // telephone number to send sms
readSerial(remoteNum);
Serial.println(remoteNum);
// sms text
Serial.print("Now, enter SMS content: ");
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
// send the message
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
/*
Read input serial
*/
int readSerial(char result[])
{
int i = 0;
while(1)
{
while (Serial.available() > 0)
{
char inChar = Serial.read();
if (inChar == '\n')
{
result[i] = '\0';
Serial.flush();
return 0;
}
if(inChar!='\r')
{
result[i] = inChar;
i++;
}
}
}
}
The program seems to be uploaded fine to the Arduino though I get some sort of error message. I don't know if this means anything is wrong: avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: Version 5.11, compiled on Sep 2 2011 at 19:38:36
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\Program Files (x86)\Arduino\hardware/tools/avr/etc/avrdude.conf"
Using Port : \\.\COM3
Using Programmer : arduino
Overriding Baud Rate : 115200
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Send: 0 [30] [20]
avrdude: Recv:
avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude done. Thank you.
When running the program on the Arduino I can open the Serial Watcher thingy which gives the following output:
SMS Messages Sender
TEST1
TEST2
Ergo my program seems to be stuck at if(gsmAccess.begin(PINNUMBER)==GSM_READY) and is never getting anywhere.
I don't have an original GSM Arduino module, but this one:
http://www.geeetech.com/wiki/index.php/Arduino_GPRS_Shield#Indicator_LEDs
I have tried every possible configuration on the shield.
Does anyone have any ideas of what I could try next? I haven't found anything on Google or on this forum. I have attached some pictures:
Thanks! ![]()