hello, I searched the forum but have not found anything that describes my case.
I just started a few days with arduino and do not know the rules of the forum
I live in Roma (Italy)
I'm using arduino mega 2560 rev3 and gsm shield developed with TELEFONICA, Windows 7 64bit and Arduino 1.0.5
I'm using my own sim that is enabled to send sms.
When I connect arduino, the sim can be reached by phone. (the phone rings!)
I use the example to send text messages, but "gsmAccess.begin" returns only the state "CONNECTING" in place of the state "GSM_READY" and are not able to send sms.
In debug I get only "AT%13%".
I tried to send sms with the sim in the phone and everything works.
I tried with the correct PinNumber ("xxxx") and without PinNumber ("")
I tried the "RESET" button on the board
On the board, the LED "ON" is lit and flashing LEDs "NET" and "STATUS"
I tried to change sim but the problem remains.
I attach source and output
can someone help me?
any ideas?
thanks
Marco
#SKETCH
#include <GSM.h>
GSM gsmAccess(true);
GSM_SMS sms;
void setup()
{
Serial.begin(9600);
char code='X';
while(true)
{
Serial.println("try Access");
code=gsmAccess.begin("",true,false); // code=gsmAccess.begin("0000",true,false); // my pin is "0000"
Serial.println("\nAfter Access");
if(code==GSM_READY)
{
Serial.println("code is GSM_READY");
break;
}
if(code==CONNECTING)
{
Serial.println("code is CONNECTING");
}
if(code==ERROR) {Serial.println("code is ERROR");}
if(code==IDLE) {Serial.println("code is IDLE");}
if(code==GPRS_READY) {Serial.println("code is GPRS_READY");}
if(code==TRANSPARENT_CONNECTED) {Serial.println("code is TRANSPARENT_CONNECTED");}
delay(1000);
}
}
void loop()
{
}
SERIAL OUTPUT
try Access
AT%13%
After Access
code is CONNECTING
try Access
AT%13%
After Access
code is CONNECTING
try Access
...
I tested your code and it don't work. Can you try this code? (official example)
/*
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 "" // Write your PIN number
// initialize the library instance
GSM gsmAccess;
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");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}
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++;
}
}
}
}
davidgoth thanks, I solved the problem.
the jumper connection between the digital pins 2:10 was not working properly.
also the example official did not work.
now everything works correctly even with my source
marcobaitelli:
davidgoth thanks, I solved the problem.
the jumper connection between the digital pins 2:10 was not working properly.
now everything works correctly even with my source
thank you all.
Hi! May I know how the jumper connection was "not working properly" and how you fixed it?
I am using Arduino MEGA too and I've tried the jumper connection but then it never goes to "GSM_READY". It's stuck at "Not connected". I used the official code by the way.