aboutsummaryrefslogtreecommitdiff
path: root/libraries/GSM/examples
diff options
context:
space:
mode:
authorFede85 <f.vanzati@gmail.com>2013-07-03 22:55:18 +0200
committerFede85 <f.vanzati@gmail.com>2013-07-03 22:55:18 +0200
commit21ca174dbe051346c94c857c39dff08c96fb5939 (patch)
tree43ddf0d7712393494498dbedad76582f58bf0497 /libraries/GSM/examples
parentfd8c367304fe62a107332db19880c88f9ac0d082 (diff)
GSM library to the new format and some strings adaptations
Diffstat (limited to 'libraries/GSM/examples')
-rw-r--r--libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino186
-rw-r--r--libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino167
-rw-r--r--libraries/GSM/examples/GsmTwitterClient/GsmTwitterClient.ino162
-rw-r--r--libraries/GSM/examples/GsmWebClient/GsmWebClient.ino109
-rw-r--r--libraries/GSM/examples/GsmWebServer/GsmWebServer.ino118
-rw-r--r--libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino116
-rw-r--r--libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino98
-rw-r--r--libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino105
-rw-r--r--libraries/GSM/examples/SendSMS/SendSMS.ino110
-rw-r--r--libraries/GSM/examples/Tools/BandManagement/BandManagement.ino120
-rw-r--r--libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino95
-rw-r--r--libraries/GSM/examples/Tools/PinManagement/PinManagement.ino168
-rw-r--r--libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino204
-rw-r--r--libraries/GSM/examples/Tools/TestModem/TestModem.ino77
-rw-r--r--libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino85
15 files changed, 0 insertions, 1920 deletions
diff --git a/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino b/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
deleted file mode 100644
index 2885c9b..0000000
--- a/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- GSM Pachube client
-
- This sketch connects an analog sensor to Pachube (http://www.pachube.com)
- using a Telefonica GSM/GPRS shield.
-
- This example has been updated to use version 2.0 of the Pachube.com API.
- To make it work, create a feed with a datastream, and give it the ID
- sensor1. Or change the code below to match your feed.
-
- Circuit:
- * Analog sensor attached to analog in 0
- * GSM shield attached to an Arduino
- * SIM card with a data plan
-
- created 4 March 2012
- by Tom Igoe
- and adapted for GSM shield by David Del Peral
-
- This code is in the public domain.
-
- http://arduino.cc/en/Tutorial/GSMExamplesPachubeClient
-
- */
-
-// libraries
-#include <GSM.h>
-
-// Pachube Client data
-#define APIKEY "YOUR API KEY GOES HERE" // replace your pachube api key here
-#define FEEDID 00000 // replace your feed ID
-#define USERAGENT "My Project" // user agent is the project name
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "password" // replace with your GPRS password
-
-// initialize the library instance:
-GSMClient client;
-GPRS gprs;
-GSM gsmAccess;
-
-// if you don't want to use DNS (and reduce your sketch size)
-// use the numeric IP instead of the name for the server:
-// IPAddress server(216,52,233,121); // numeric IP for api.pachube.com
-char server[] = "api.pachube.com"; // name address for pachube API
-
-unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
-boolean lastConnected = false; // state of the connection last time through the main loop
-const unsigned long postingInterval = 10*1000; //delay between updates to Pachube.com
-
-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
- }
-
- // connection state
- boolean notConnected = true;
-
- // After starting the modem with GSM.begin()
- // attach the shield to the GPRS network with the APN, login and password
- while(notConnected)
- {
- if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
- notConnected = false;
- else
- {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-}
-
-void loop()
-{
- // read the analog sensor:
- int sensorReading = analogRead(A0);
-
- // if there's incoming data from the net connection.
- // send it out the serial port. This is for debugging
- // purposes only:
- if (client.available())
- {
- char c = client.read();
- Serial.print(c);
- }
-
- // if there's no net connection, but there was one last time
- // through the loop, then stop the client:
- if (!client.connected() && lastConnected)
- {
- client.stop();
- }
-
- // if you're not connected, and ten seconds have passed since
- // your last connection, then connect again and send data:
- if(!client.connected() && ((millis() - lastConnectionTime) > postingInterval))
- {
- sendData(sensorReading);
- }
-
- // store the state of the connection for next time through
- // the loop:
- lastConnected = client.connected();
-}
-
-/*
- This method makes a HTTP connection to the server.
-*/
-void sendData(int thisData)
-{
- // if there's a successful connection:
- if (client.connect(server, 80))
- {
- Serial.println("connecting...");
-
- // send the HTTP PUT request:
- client.print("PUT /v2/feeds/");
- client.print(FEEDID);
- client.println(".csv HTTP/1.1");
- client.println("Host: api.pachube.com");
- client.print("X-ApiKey: ");
- client.println(APIKEY);
- client.print("User-Agent: ");
- client.println(USERAGENT);
- client.print("Content-Length: ");
-
- // calculate the length of the sensor reading in bytes:
- // 8 bytes for "sensor1," + number of digits of the data:
- int thisLength = 8 + getLength(thisData);
- client.println(thisLength);
-
- // last pieces of the HTTP PUT request:
- client.println("Content-Type: text/csv");
- client.println("Connection: close");
- client.println();
-
- // here's the actual content of the PUT request:
- client.print("sensor1,");
- client.println(thisData);
- }
- else
- {
- // if you couldn't make a connection:
- Serial.println("connection failed");
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
- }
- // note the time that the connection was made or attempted
- lastConnectionTime = millis();
-}
-
-/*
- This method calculates the number of digits in the
- sensor reading. Since each digit of the ASCII decimal
- representation is a byte, the number of digits equals
- the number of bytes.
-*/
-int getLength(int someValue)
-{
- // there's at least one byte:
- int digits = 1;
-
- // continually divide the value by ten,
- // adding one to the digit count for each
- // time you divide, until you're at 0:
- int dividend = someValue /10;
- while (dividend > 0)
- {
- dividend = dividend /10;
- digits++;
- }
-
- // return the number of digits:
- return digits;
-}
-
diff --git a/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino b/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
deleted file mode 100644
index 9f6ea53..0000000
--- a/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- Pachube client with Strings
-
- This sketch connects two analog sensors to Pachube (http://www.pachube.com)
- through a Telefonica GSM/GPRS shield.
-
- This example has been updated to use version 2.0 of the Pachube.com API.
- To make it work, create a feed with two datastreams, and give them the IDs
- sensor1 and sensor2. Or change the code below to match your feed.
-
- This example uses the String library, which is part of the Arduino core from
- version 0019.
-
- Circuit:
- * Analog sensors attached to A0 and A1
- * GSM shield attached to an Arduino
- * SIM card with a data plan
-
- created 8 March 2012
- by Tom Igoe
- and adapted for GSM shield by David Del Peral
-
- This code is in the public domain.
-
- */
-
-// Include the GSM library
-#include <GSM.h>
-
-// Pachube login information
-#define APIKEY "YOUR API KEY GOES HERE" // replace your pachube api key here
-#define FEEDID 00000 // replace your feed ID
-#define USERAGENT "My Project" // user agent is the project name
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "password" // replace with your GPRS password
-
-// initialize the library instance
-GSMClient client;
-GPRS gprs;
-GSM gsmAccess;
-
-// if you don't want to use DNS (and reduce your sketch size)
-// use the numeric IP instead of the name for the server:
-// IPAddress server(216,52,233,121); // numeric IP for api.pachube.com
-char server[] = "api.pachube.com"; // name address for Pachube API
-
-unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
-boolean lastConnected = false; // state of the connection last time through the main loop
-const unsigned long postingInterval = 10*1000; // delay between updates to Pachube.com
-
-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
- }
-
- // connection state
- boolean notConnected = true;
-
- // After starting the modem with GSM.begin()
- // attach the shield to the GPRS network with the APN, login and password
- while(notConnected)
- {
- if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
- notConnected = false;
- else
- {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("Connected to GPRS network");
-}
-
-void loop()
-{
- // read the sensor on A0
- int sensorReading = analogRead(A0);
-
- // convert the data to a String
- String dataString = "sensor1,";
- dataString += sensorReading;
-
- // you can append multiple readings to this String to
- // send the pachube feed multiple values
- int otherSensorReading = analogRead(A1);
- dataString += "\nsensor2,";
- dataString += otherSensorReading;
-
- // if there's incoming data from the net connection.
- // send it out the serial port. This is for debugging
- // purposes only
- if (client.available())
- {
- char c = client.read();
- Serial.print(c);
- }
-
- // if there's no net connection, but there was one last time
- // through the loop, then stop the client
- if (!client.connected() && lastConnected)
- {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
- }
-
- // if you're not connected, and ten seconds have passed since
- // your last connection, then connect again and send data
- if(!client.connected() && (millis() - lastConnectionTime > postingInterval))
- {
- sendData(dataString);
- }
- // store the state of the connection for next time through
- // the loop
- lastConnected = client.connected();
-}
-
-// this method makes a HTTP connection to the server
-void sendData(String thisData)
-{
- // if there's a successful connection:
- if (client.connect(server, 80))
- {
- Serial.println("connecting...");
-
- // send the HTTP PUT request:
- client.print("PUT /v2/feeds/");
- client.print(FEEDID);
- client.println(".csv HTTP/1.1");
- client.println("Host: api.pachube.com");
- client.print("X-ApiKey: ");
- client.println(APIKEY);
- client.print("User-Agent: ");
- client.println(USERAGENT);
- client.print("Content-Length: ");
- client.println(thisData.length());
-
- // last pieces of the HTTP PUT request
- client.println("Content-Type: text/csv");
- client.println("Connection: close");
- client.println();
-
- // here's the actual content of the PUT request
- client.println(thisData);
- }
- else
- {
- // if you couldn't make a connection
- Serial.println("connection failed");
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
- }
- // note the time that the connection was made or attempted:
- lastConnectionTime = millis();
-}
diff --git a/libraries/GSM/examples/GsmTwitterClient/GsmTwitterClient.ino b/libraries/GSM/examples/GsmTwitterClient/GsmTwitterClient.ino
deleted file mode 100644
index 3032141..0000000
--- a/libraries/GSM/examples/GsmTwitterClient/GsmTwitterClient.ino
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- GSM Twitter Client with Strings
-
- This sketch connects to Twitter using an Arduino GSM shield.
- It parses the XML returned, and looks for the string <text>this is a tweet</text>
-
- This example uses the String library, which is part of the Arduino core from
- version 0019.
-
- Circuit:
- * GSM shield attached to an Arduino
- * SIM card with a data plan
-
- created 8 Mar 2012
- by Tom Igoe
-
- http://arduino.cc/en/Tutorial/GSMExamplesTwitterClient
-
- This code is in the public domain.
-
- */
-
-// libraries
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "APN" // replace your GPRS APN
-#define GPRS_LOGIN "LOGIN" // replace with your GPRS login
-#define GPRS_PASSWORD "PASSWORD" // replace with your GPRS password
-
-// initialize the library instance
-GSMClient client;
-GPRS gprs;
-GSM gsmAccess;
-
-const unsigned long requestInterval = 30*1000; // delay between requests: 30 seconds
-
-// API Twitter URL
-char server[] = "api.twitter.com";
-
-boolean requested; // whether you've made a request since connecting
-unsigned long lastAttemptTime = 0; // last time you connected to the server, in milliseconds
-
-String currentLine = ""; // string to hold the text from server
-String tweet = ""; // string to hold the tweet
-boolean readingTweet = false; // if you're currently reading the tweet
-
-void setup()
-{
- // reserve space for the strings:
- currentLine.reserve(256);
- tweet.reserve(150);
-
- // initialize serial communications and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- // connection state
- boolean notConnected = true;
-
- // After starting the modem with GSM.begin()
- // attach the shield to the GPRS network with the APN, login and password
- while(notConnected)
- {
- if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
- notConnected = false;
- else
- {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("Connected to GPRS network");
-
- Serial.println("connecting...");
- connectToServer();
-}
-
-
-
-void loop()
-{
- char c;
- if (client.connected())
- {
- if (client.available())
- {
- // read incoming bytes:
- char inChar = client.read();
-
- // add incoming byte to end of line:
- currentLine += inChar;
-
- // if you get a newline, clear the line:
- if (inChar == '\n')
- {
- currentLine = "";
- }
-
- // if the current line ends with <text>, it will
- // be followed by the tweet:
- if (currentLine.endsWith("<text>"))
- {
- // tweet is beginning. Clear the tweet string:
- readingTweet = true;
- tweet = "";
- }
-
- // if you're currently reading the bytes of a tweet,
- // add them to the tweet String:
- if (readingTweet)
- {
- if (inChar != '<')
- {
- tweet += inChar;
- }
- else
- {
- // if you got a "<" character,
- // you've reached the end of the tweet:
- readingTweet = false;
- Serial.println(tweet);
-
- // close the connection to the server:
- client.stop();
- }
- }
- }
- }
- else if (millis() - lastAttemptTime > requestInterval)
- {
- // if you're not connected, and two minutes have passed since
- // your last connection, then attempt to connect again:
- connectToServer();
- }
-}
-
-/*
- Connect to API Twitter server and do a request for timeline
-*/
-void connectToServer()
-{
- // attempt to connect, and wait a millisecond:
- Serial.println("connecting to server...");
- if (client.connect(server, 80))
- {
- Serial.println("making HTTP request...");
- // make HTTP GET request to twitter:
- client.println("GET /1/statuses/user_timeline.xml?screen_name=arduino&count=1 HTTP/1.1");
- client.println("HOST: api.twitter.com");
- client.println();
- }
- // note the time of this connect attempt:
- lastAttemptTime = millis();
-}
diff --git a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino b/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
deleted file mode 100644
index e7eb275..0000000
--- a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- Web client
-
- This sketch connects to a website through a GSM shield. Specifically,
- this example downloads the URL "http://arduino.cc/asciilogo.txt" and
- prints it to the Serial monitor.
-
- Circuit:
- * GSM shield attached to an Arduino
- * SIM card with a data plan
-
- created 8 Mar 2012
- by Tom Igoe
-
- http://arduino.cc/en/Tutorial/GSMExamplesWebClient
-
- */
-
-// libraries
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "password" // replace with your GPRS password
-
-// initialize the library instance
-GSMClient client;
-GPRS gprs;
-GSM gsmAccess;
-
-// URL, path & port (for example: arduino.cc)
-char server[] = "arduino.cc";
-char path[] = "/asciilogo.txt";
-int port = 80; // port 80 is the default for HTTP
-
-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("Starting Arduino web client.");
- // connection state
- boolean notConnected = true;
-
- // After starting the modem with GSM.begin()
- // attach the shield to the GPRS network with the APN, login and password
- while(notConnected)
- {
- if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
- notConnected = false;
- else
- {
- Serial.println("Not connected");
- delay(1000);
- }
- }
-
- Serial.println("connecting...");
-
- // if you get a connection, report back via serial:
- if (client.connect(server, port))
- {
- Serial.println("connected");
- // Make a HTTP request:
- client.print("GET ");
- client.print(path);
- client.println(" HTTP/1.1");
- client.print("Host: ");
- client.println(server);
- client.println("Connection: close");
- client.println();
- }
- else
- {
- // if you didn't get a connection to the server:
- Serial.println("connection failed");
- }
-}
-
-void loop()
-{
- // if there are incoming bytes available
- // from the server, read them and print them:
- if (client.available())
- {
- char c = client.read();
- Serial.print(c);
- }
-
- // if the server's disconnected, stop the client:
- if (!client.available() && !client.connected())
- {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
-
- // do nothing forevermore:
- for(;;)
- ;
- }
-}
diff --git a/libraries/GSM/examples/GsmWebServer/GsmWebServer.ino b/libraries/GSM/examples/GsmWebServer/GsmWebServer.ino
deleted file mode 100644
index e957b4c..0000000
--- a/libraries/GSM/examples/GsmWebServer/GsmWebServer.ino
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- GSM Web Server
-
- A simple web server that shows the value of the analog input pins.
- using a GSM shield.
-
- Circuit:
- * GSM shield attached
- * Analog inputs attached to pins A0 through A5 (optional)
-
- created 8 Mar 2012
- by Tom Igoe
- */
-
-// libraries
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// APN data
-#define GPRS_APN "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "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 and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- // 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) &
- (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
- notConnected = false;
- 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() {
-
-
- // listen for incoming clients
- GSMClient client = server.available();
-
-
-
- if (client)
- {
- while (client.connected())
- {
- if (client.available())
- {
- Serial.println("Receiving request!");
- bool sendResponse = false;
- while(char c=client.read()) {
- if (c == '\n') sendResponse = true;
- }
-
- // if you've gotten to the end of the line (received a newline
- // character)
- if (sendResponse)
- {
- // send a standard http response header
- client.println("HTTP/1.1 200 OK");
- client.println("Content-Type: text/html");
- client.println();
- client.println("<html>");
- // output the value of each analog input pin
- for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
- client.print("analog input ");
- client.print(analogChannel);
- client.print(" is ");
- client.print(analogRead(analogChannel));
- client.println("<br />");
- }
- client.println("</html>");
- //necessary delay
- delay(1000);
- client.stop();
- }
- }
- }
- }
-}
-
-
diff --git a/libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino b/libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino
deleted file mode 100644
index 64df44a..0000000
--- a/libraries/GSM/examples/MakeVoiceCall/MakeVoiceCall.ino
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- Make Voice Call
-
- This sketch, for the Arduino GSM shield, puts a voice call to
- a remote phone number that you enter through the serial monitor.
- To make it work, open the serial monitor, and when you see the
- READY message, type a phone number. Make sure the serial monitor
- is set to send a just newline when you press return.
-
- Circuit:
- * GSM shield
- * Voice circuit.
- With no voice circuit the call will send nor receive any sound
-
-
- created Mar 2012
- by Javier Zorzano
-
- This example is in the public domain.
- */
-
-// libraries
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess; // include a 'true' parameter for debug enabled
-GSMVoiceCall vcs;
-
-String remoteNumber = ""; // the number you will call
-char charbuffer[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 Leonardo only
- }
-
- Serial.println("Make Voice Call");
-
- // 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.");
- Serial.println("Enter phone number to call.");
-
-}
-
-void loop()
-{
-
- // add any incoming characters to the String:
- while (Serial.available() > 0)
- {
- char inChar = Serial.read();
- // if it's a newline, that means you should make the call:
- if (inChar == '\n')
- {
- // make sure the phone number is not too long:
- if (remoteNumber.length() < 20)
- {
- // let the user know you're calling:
- Serial.print("Calling to : ");
- Serial.println(remoteNumber);
- Serial.println();
-
- // Call the remote number
- remoteNumber.toCharArray(charbuffer, 20);
-
-
- // Check if the receiving end has picked up the call
- if(vcs.voiceCall(charbuffer))
- {
- Serial.println("Call Established. Enter line to end");
- // Wait for some input from the line
- while(Serial.read()!='\n' && (vcs.getvoiceCallStatus()==TALKING));
- // And hang up
- vcs.hangCall();
- }
- Serial.println("Call Finished");
- remoteNumber="";
- Serial.println("Enter phone number to call.");
- }
- else
- {
- Serial.println("That's too long for a phone number. I'm forgetting it");
- remoteNumber = "";
- }
- }
- else
- {
- // add the latest character to the message to send:
- if(inChar!='\r')
- remoteNumber += inChar;
- }
- }
-}
-
diff --git a/libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino b/libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino
deleted file mode 100644
index af800f4..0000000
--- a/libraries/GSM/examples/ReceiveSMS/ReceiveSMS.ino
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- 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.
-
- http://arduino.cc/en/Tutorial/GSMExamplesReceiveSMS
-
-*/
-
-// 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 Leonardo only
- }
-
- Serial.println("SMS Messages Receiver");
-
- // connection state
- boolean notConnected = true;
-
- // 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);
-
-}
-
-
diff --git a/libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino b/libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino
deleted file mode 100644
index 14dbc5e..0000000
--- a/libraries/GSM/examples/ReceiveVoiceCall/ReceiveVoiceCall.ino
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- Receive Voice Call
-
- This sketch, for the Arduino GSM shield, receives voice calls,
- displays the calling number, waits a few seconds then hangs up.
-
- Circuit:
- * GSM shield
- * Voice circuit. Refer to to the GSM shield getting started guide
- at http://arduino.cc/en/Guide/ArduinoGSMShield#toc11
- * SIM card that can accept voice calls
-
- With no voice circuit the call will connect, but will not send or receive sound
-
- created Mar 2012
- by Javier Zorzano
-
- This example is in the public domain.
-
- http://arduino.cc/en/Tutorial/GSMExamplesReceiveVoiceCall
-
- */
-
-// Include the GSM library
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess;
-GSMVoiceCall vcs;
-
-// Array to hold the number for the incoming call
-char numtel[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 Leonardo only
- }
-
- Serial.println("Receive Voice Call");
-
- // 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);
- }
- }
-
- // This makes sure the modem correctly reports incoming events
- vcs.hangCall();
-
- Serial.println("Waiting for a call");
-}
-
-void loop()
-{
- // Check the status of the voice call
- switch (vcs.getvoiceCallStatus())
- {
- case IDLE_CALL: // Nothing is happening
-
- break;
-
- case RECEIVINGCALL: // Yes! Someone is calling us
-
- Serial.println("RECEIVING CALL");
-
- // Retrieve the calling number
- vcs.retrieveCallingNumber(numtel, 20);
-
- // Print the calling number
- Serial.print("Number:");
- Serial.println(numtel);
-
- // Answer the call, establish the call
- vcs.answerCall();
- break;
-
- case TALKING: // In this case the call would be established
-
- Serial.println("TALKING. Press enter to hang up.");
- while(Serial.read()!='\n')
- delay(100);
- vcs.hangCall();
- Serial.println("Hanging up and waiting for the next call.");
- break;
- }
- delay(1000);
-}
-
-
diff --git a/libraries/GSM/examples/SendSMS/SendSMS.ino b/libraries/GSM/examples/SendSMS/SendSMS.ino
deleted file mode 100644
index 677442a..0000000
--- a/libraries/GSM/examples/SendSMS/SendSMS.ino
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- 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 ""
-
-// 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++;
- }
- }
- }
-}
diff --git a/libraries/GSM/examples/Tools/BandManagement/BandManagement.ino b/libraries/GSM/examples/Tools/BandManagement/BandManagement.ino
deleted file mode 100644
index 84d8c71..0000000
--- a/libraries/GSM/examples/Tools/BandManagement/BandManagement.ino
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- Band Management
-
- This sketch, for the Arduino GSM shield, checks the band
- currently configured in the modem and allows you to change
- it.
-
- Please check http://www.worldtimezone.com/gsm.html
- Usual configurations:
- Europe, Africa, Middle East: E-GSM(900)+DCS(1800)
- USA, Canada, South America: GSM(850)+PCS(1900)
- Mexico: PCS(1900)
- Brazil: GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)
-
-
- Circuit:
- * GSM shield
-
- created 12 June 2012
- by Javier Zorzano, Scott Fitzgerald
-
- This example is in the public domain.
- */
-
-// libraries
-#include <GSM.h>
-
-// initialize the library instance
-GSMBand band;
-
-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
- }
-
- // Beginning the band manager restarts the modem
- Serial.println("Restarting modem...");
- band.begin();
- Serial.println("Modem restarted.");
-
-};
-
-
-void loop()
-{
- // Get current band
- String bandName = band.getBand(); // Get and print band name
- Serial.print("Current band:");
- Serial.println(bandName);
- Serial.println("Want to change the band you’re on?");
- String newBandName;
- newBandName = askUser();
- // Tell the user what we are about to do…
- Serial.print("\nConfiguring band ");
- Serial.println(newBandName);
- // Change the band
- boolean operationSuccess;
- operationSuccess = band.setBand(newBandName);
- // Tell the user if the operation was OK
- if(operationSuccess)
- {
- Serial.println("Success");
- }
- else
- {
- Serial.println("Error while changing band");
- }
-
- if(operationSuccess)
- {
- while(true);
- }
-}
-
-// This function offers the user different options
-// through the Serial interface
-// The user selects one
-String askUser()
-{
- String newBand;
- Serial.println("Select band:");
- // Print the different options
- Serial.println("1 : E-GSM(900)");
- Serial.println("2 : DCS(1800)");
- Serial.println("3 : PCS(1900)");
- Serial.println("4 : E-GSM(900)+DCS(1800) ex: Europe");
- Serial.println("5 : GSM(850)+PCS(1900) Ex: USA, South Am.");
- Serial.println("6 : GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)");
-
- // Empty the incoming buffer
- while(Serial.available())
- Serial.read();
-
- // Wait for an answer, just look at the first character
- while(!Serial.available());
- char c= Serial.read();
- if(c=='1')
- newBand=GSM_MODE_EGSM;
- else if(c=='2')
- newBand=GSM_MODE_DCS;
- else if(c=='3')
- newBand=GSM_MODE_PCS;
- else if(c=='4')
- newBand=GSM_MODE_EGSM_DCS;
- else if(c=='5')
- newBand=GSM_MODE_GSM850_PCS;
- else if(c=='6')
- newBand=GSM_MODE_GSM850_EGSM_DCS_PCS;
- else
- newBand="GSM_MODE_UNDEFINED";
- return newBand;
-}
-
-
-
-
-
diff --git a/libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino b/libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino
deleted file mode 100644
index 0e442eb..0000000
--- a/libraries/GSM/examples/Tools/GsmScanNetworks/GsmScanNetworks.ino
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-
- GSM Scan Networks
-
- This example prints out the IMEI number of the modem,
- then checks to see if it's connected to a carrier. If so,
- it prints the phone number associated with the card.
- Then it scans for nearby networks and prints out their signal strengths.
-
- Circuit:
- * GSM shield
- * SIM card
-
- Created 8 Mar 2012
- by Tom Igoe, implemented by Javier Carazo
- Modified 4 Feb 2013
- by Scott Fitzgerald
-
- http://arduino.cc/en/Tutorial/GSMToolsGsmScanNetworks
-
- This example code is part of the public domain
- */
-
-// libraries
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess; // include a 'true' parameter to enable debugging
-GSMScanner scannerNetworks;
-GSMModem modemTest;
-
-// Save data variables
-String IMEI = "";
-
-// serial monitor result messages
-String errortext = "ERROR";
-
-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("GSM networks scanner");
- scannerNetworks.begin();
-
- // 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);
- }
- }
-
- // get modem parameters
- // IMEI, modem unique identifier
- Serial.print("Modem IMEI: ");
- IMEI = modemTest.getIMEI();
- IMEI.replace("\n","");
- if(IMEI != NULL)
- Serial.println(IMEI);
-}
-
-void loop()
-{
- // scan for existing networks, displays a list of networks
- Serial.println("Scanning available networks. May take some seconds.");
- Serial.println(scannerNetworks.readNetworks());
-
- // currently connected carrier
- Serial.print("Current carrier: ");
- Serial.println(scannerNetworks.getCurrentCarrier());
-
- // returns strength and ber
- // signal strength in 0-31 scale. 31 means power > 51dBm
- // BER is the Bit Error Rate. 0-7 scale. 99=not detectable
- Serial.print("Signal Strength: ");
- Serial.print(scannerNetworks.getSignalStrength());
- Serial.println(" [0-31]");
-
-}
-
diff --git a/libraries/GSM/examples/Tools/PinManagement/PinManagement.ino b/libraries/GSM/examples/Tools/PinManagement/PinManagement.ino
deleted file mode 100644
index 654d1b8..0000000
--- a/libraries/GSM/examples/Tools/PinManagement/PinManagement.ino
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
-
- This example enables you to change or remove the PIN number of
- a SIM card inserted into a GSM shield.
-
- Circuit:
- * GSM shield
- * SIM card
-
- Created 12 Jun 2012
- by David del Peral
-
- This example code is part of the public domain
-
- http://arduino.cc/en/Tutorial/GSMToolsPinManagement
-
- */
-
-// libraries
-#include <GSM.h>
-
-// pin manager object
-GSMPIN PINManager;
-
-// save input in serial by user
-String user_input = "";
-
-// authenticated with PIN code
-boolean auth = false;
-
-// serial monitor result messages
-String oktext = "OK";
-String errortext = "ERROR";
-
-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("Change PIN example\n");
- PINManager.begin();
-
- // check if the SIM have pin lock
- while(!auth){
- int pin_query = PINManager.isPIN();
- if(pin_query == 1)
- {
- // if SIM is locked, enter PIN code
- Serial.print("Enter PIN code: ");
- user_input = readSerial();
- // check PIN code
- if(PINManager.checkPIN(user_input) == 0)
- {
- auth = true;
- PINManager.setPINUsed(true);
- Serial.println(oktext);
- }
- else
- {
- // if PIN code was incorrected
- Serial.println("Incorrect PIN. Remember that you have 3 opportunities.");
- }
- }
- else if(pin_query == -1)
- {
- // PIN code is locked, user must enter PUK code
- Serial.println("PIN locked. Enter PUK code: ");
- String puk = readSerial();
- Serial.print("Now, enter a new PIN code: ");
- user_input = readSerial();
- // check PUK code
- if(PINManager.checkPUK(puk, user_input) == 0)
- {
- auth = true;
- PINManager.setPINUsed(true);
- Serial.println(oktext);
- }
- else
- {
- // if PUK o the new PIN are incorrect
- Serial.println("Incorrect PUK or invalid new PIN. Try again!.");
- }
- }
- else if(pin_query == -2)
- {
- // the worst case, PIN and PUK are locked
- Serial.println("PIN & PUK locked. Use PIN2/PUK2 in a mobile phone.");
- while(true);
- }
- else
- {
- // SIM does not requires authetication
- Serial.println("No pin necessary.");
- auth = true;
- }
- }
-
- // start GSM shield
- Serial.print("Checking register in GSM network...");
- if(PINManager.checkReg() == 0)
- Serial.println(oktext);
- // if you are connect by roaming
- else if(PINManager.checkReg() == 1)
- Serial.println("ROAMING " + oktext);
- else
- {
- // error connection
- Serial.println(errortext);
- while(true);
- }
-}
-
-void loop()
-{
- // Function loop implements pin management user menu
- // Only if you SIM use pin lock, you can change PIN code
- // user_op variables save user option
-
- Serial.println("Choose an option:\n1 - On/Off PIN.");
- if(PINManager.getPINUsed())
- Serial.println("2 - Change PIN.");
- String user_op = readSerial();
- if(user_op == "1")
- {
- Serial.println("Enter your PIN code:");
- user_input = readSerial();
- // activate/deactivate PIN lock
- PINManager.switchPIN(user_input);
- }
- else if(user_op == "2" & PINManager.getPINUsed())
- {
- Serial.println("Enter your actual PIN code:");
- String oldPIN = readSerial();
- Serial.println("Now, enter your new PIN code:");
- String newPIN = readSerial();
- // change PIN
- PINManager.changePIN(oldPIN, newPIN);
- }
- else
- {
- Serial.println("Incorrect option. Try again!.");
- }
- delay(1000);
-}
-
-/*
- Read input serial
- */
-String readSerial()
-{
- String text = "";
- while(1)
- {
- while (Serial.available() > 0)
- {
- char inChar = Serial.read();
- if (inChar == '\n')
- {
- return text;
- }
- if(inChar!='\r')
- text += inChar;
- }
- }
-}
diff --git a/libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino b/libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino
deleted file mode 100644
index ab4a2be..0000000
--- a/libraries/GSM/examples/Tools/TestGPRS/TestGPRS.ino
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
-
- This sketch test the GSM shield's ability to connect to a
- GPERS network. It asks for APN information through the
- serial monitor and tries to connect to arduino.cc.
-
- Circuit:
- * GSM shield attached
- * SIM card with data plan
-
- Created 18 Jun 2012
- by David del Peral
-
- This example code is part of the public domain
-
- http://arduino.cc/en/Tutorial/GSMToolsTestGPRS
-
- */
-
-// libraries
-#include <GSM.h>
-
-// PIN Number
-#define PINNUMBER ""
-
-// initialize the library instance
-GSM gsmAccess; // GSM access: include a 'true' parameter for debug enabled
-GPRS gprsAccess; // GPRS access
-GSMClient client; // Client service for TCP connection
-
-// messages for serial monitor response
-String oktext = "OK";
-String errortext = "ERROR";
-
-// URL and path (for example: arduino.cc)
-char url[] = "arduino.cc";
-char urlproxy[] = "http://arduino.cc";
-char path[] = "/";
-
-// variable for save response obtained
-String response = "";
-
-// use a proxy
-boolean use_proxy = false;
-
-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
- }
-}
-
-void loop()
-{
- use_proxy = false;
-
- // start GSM shield
- // if your SIM has PIN, pass it as a parameter of begin() in quotes
- Serial.print("Connecting GSM network...");
- if(gsmAccess.begin(PINNUMBER)!=GSM_READY)
- {
- Serial.println(errortext);
- while(true);
- }
- Serial.println(oktext);
-
- // read APN introduced by user
- char apn[50];
- Serial.print("Enter your APN: ");
- readSerial(apn);
- Serial.println(apn);
-
- // Read APN login introduced by user
- char login[50];
- Serial.print("Now, enter your login: ");
- readSerial(login);
- Serial.println(login);
-
- // read APN password introduced by user
- char password[20];
- Serial.print("Finally, enter your password: ");
- readSerial(password);
-
- // attach GPRS
- Serial.println("Attaching to GPRS with your APN...");
- if(gprsAccess.attachGPRS(apn, login, password)!=GPRS_READY)
- {
- Serial.println(errortext);
- }
- else{
-
- Serial.println(oktext);
-
- // read proxy introduced by user
- char proxy[100];
- Serial.print("If your carrier uses a proxy, enter it, if not press enter: ");
- readSerial(proxy);
- Serial.println(proxy);
-
- // if user introduced a proxy, asks him for proxy port
- int pport;
- if(proxy[0] != '\0'){
- // read proxy port introduced by user
- char proxyport[10];
- Serial.print("Enter the proxy port: ");
- readSerial(proxyport);
- // cast proxy port introduced to integer
- pport = (int) proxyport;
- use_proxy = true;
- Serial.println(proxyport);
- }
-
- // connection with arduino.cc and realize HTTP request
- Serial.print("Connecting and sending GET request to arduino.cc...");
- int res_connect;
-
- // if use a proxy, connect with it
- if(use_proxy)
- res_connect = client.connect(proxy, pport);
- else
- res_connect = client.connect(url, 80);
-
- if (res_connect)
- {
- // make a HTTP 1.0 GET request (client sends the request)
- client.print("GET ");
-
- // if use a proxy, the path is arduino.cc URL
- if(use_proxy)
- client.print(urlproxy);
- else
- client.print(path);
-
- client.println(" HTTP/1.0");
- client.println();
- Serial.println(oktext);
- }
- else
- {
- // if you didn't get a connection to the server
- Serial.println(errortext);
- }
- Serial.print("Receiving response...");
-
- boolean test = true;
- while(test)
- {
- // if there are incoming bytes available
- // from the server, read and check them
- if (client.available())
- {
- char c = client.read();
- response += c;
-
- // cast response obtained from string to char array
- char responsechar[response.length()+1];
- response.toCharArray(responsechar, response.length()+1);
-
- // if response includes a "200 OK" substring
- if(strstr(responsechar, "200 OK") != NULL){
- Serial.println(oktext);
- Serial.println("TEST COMPLETE!");
- test = false;
- }
- }
-
- // if the server's disconnected, stop the client:
- if (!client.connected())
- {
- Serial.println();
- Serial.println("disconnecting.");
- client.stop();
- test = false;
- }
- }
- }
-}
-
-/*
- 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';
- return 0;
- }
- if(inChar!='\r')
- {
- result[i] = inChar;
- i++;
- }
- }
- }
-}
diff --git a/libraries/GSM/examples/Tools/TestModem/TestModem.ino b/libraries/GSM/examples/Tools/TestModem/TestModem.ino
deleted file mode 100644
index de61fff..0000000
--- a/libraries/GSM/examples/Tools/TestModem/TestModem.ino
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-
- This example tests to see if the modem of the
- GSM shield is working correctly. You do not need
- a SIM card for this example.
-
- Circuit:
- * GSM shield attached
-
- Created 12 Jun 2012
- by David del Peral
- modified 21 Nov 2012
- by Tom Igoe
-
- http://arduino.cc/en/Tutorial/GSMToolsTestModem
-
- This sample code is part of the public domain
-
- */
-
-// libraries
-#include <GSM.h>
-
-// modem verification object
-GSMModem modem;
-
-// IMEI variable
-String IMEI = "";
-
-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
- }
-
- // start modem test (reset and check response)
- Serial.print("Starting modem test...");
- if(modem.begin())
- Serial.println("modem.begin() succeeded");
- else
- Serial.println("ERROR, no modem answer.");
-}
-
-void loop()
-{
- // get modem IMEI
- Serial.print("Checking IMEI...");
- IMEI = modem.getIMEI();
-
- // check IMEI response
- if(IMEI != NULL)
- {
- // show IMEI in serial monitor
- Serial.println("Modem's IMEI: " + IMEI);
- // reset modem to check booting:
- Serial.print("Resetting modem...");
- modem.begin();
- // get and check IMEI one more time
- if(modem.getIMEI() != NULL)
- {
- Serial.println("Modem is functoning properly");
- }
- else
- {
- Serial.println("Error: getIMEI() failed after modem.begin()");
- }
- }
- else
- {
- Serial.println("Error: Could not get IMEI");
- }
- // do nothing:
- while(true);
-}
-
diff --git a/libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino b/libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino
deleted file mode 100644
index 5cc3f8a..0000000
--- a/libraries/GSM/examples/Tools/TestWebServer/TestWebServer.ino
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- 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 "GPRS_APN" // replace your GPRS APN
-#define GPRS_LOGIN "login" // replace with your GPRS login
-#define GPRS_PASSWORD "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 and wait for port to open:
- Serial.begin(9600);
- while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
- }
-
- 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());
- }
-}
-
-}
-