I'm trying to run the following example program with my new gsm shield:
/*
Basic Web Server
A simple web server that replies with nothing, but prints the client's request
and the server IP address.
Circuit:
* GSM shield attached
created
by David Cuartielles
modified 21 Nov 2012
by Tom Igoe
http://arduino.cc/en/Tutorial/GSMToolsTestWebServer
This example code is part of the public domain
*/
#include <GSM.h>
// PIN Number
#define PINNUMBER ""
// APN data
#define GPRS_APN "bluevia.movistar.es" // replace your GPRS APN
#define GPRS_LOGIN "" // replace with your GPRS login
#define GPRS_PASSWORD "" // replace with your GPRS password
// initialize the library instance
GPRS gprs;
GSM gsmAccess(); // include a 'true' parameter for debug enabled
GSMServer server(80); // port 80 (http default)
// timeout
const unsigned long __TIMEOUT__ = 10*1000;
void setup()
{
// initialize serial communications
Serial.begin(9600);
Serial.println("starting,..");
// connection state
boolean connected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(!connected)
{
if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
connected = true;
else
{
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("Connected to GPRS network");
// start server
server.begin();
//Get IP.
IPAddress LocalIP = gprs.getIPAddress();
Serial.println("Server IP address=");
Serial.println(LocalIP);
}
void loop(){
GSMClient client = server.available();
if (client) {
if (client.available()) {
Serial.write(client.read());
}
}
}
gprs.getIPAddress always returns an IP of 0.0.0.0, which can't be correct. Am I missing something, or is there someway to communicate with the arduino using 0.0.0.0 as an ip?