aboutsummaryrefslogtreecommitdiff
path: root/libraries/GSM/examples
diff options
context:
space:
mode:
authorFederico Fissore <f.fissore@arduino.cc>2013-05-13 16:58:10 +0200
committerFederico Fissore <f.fissore@arduino.cc>2013-05-13 16:58:10 +0200
commitb70954ea256f94afdd941e2c89a086887b496c13 (patch)
treebd9fb74f61b1351a32b8b48cef8f04863d9d6df8 /libraries/GSM/examples
parentc48c0f9e2cebe0e3ebda7aa5c4f9096b9586ed9e (diff)
parent7207108255a772474b322151cb0fd113e8030afe (diff)
Merge remote-tracking branch 'arduino/ide-1.5.x' into ide-1.5.x-discovery
Diffstat (limited to 'libraries/GSM/examples')
-rw-r--r--libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino4
-rw-r--r--libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino6
-rw-r--r--libraries/GSM/examples/GsmWebClient/GsmWebClient.ino17
3 files changed, 15 insertions, 12 deletions
diff --git a/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino b/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
index 445aab5..2885c9b 100644
--- a/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
+++ b/libraries/GSM/examples/GSMPachubeClient/GSMPachubeClient.ino
@@ -126,7 +126,7 @@ void sendData(int thisData)
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
- client.print("Host: api.pachube.com\n");
+ client.println("Host: api.pachube.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
@@ -139,7 +139,7 @@ void sendData(int thisData)
client.println(thisLength);
// last pieces of the HTTP PUT request:
- client.print("Content-Type: text/csv\n");
+ client.println("Content-Type: text/csv");
client.println("Connection: close");
client.println();
diff --git a/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino b/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
index f28370e..9f6ea53 100644
--- a/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
+++ b/libraries/GSM/examples/GSMPachubeClientString/GSMPachubeClientString.ino
@@ -138,7 +138,7 @@ void sendData(String thisData)
client.print("PUT /v2/feeds/");
client.print(FEEDID);
client.println(".csv HTTP/1.1");
- client.print("Host: api.pachube.com\n");
+ client.println("Host: api.pachube.com");
client.print("X-ApiKey: ");
client.println(APIKEY);
client.print("User-Agent: ");
@@ -147,8 +147,8 @@ void sendData(String thisData)
client.println(thisData.length());
// last pieces of the HTTP PUT request
- client.print("Content-Type: text/csv\n");
- client.println("Connection: close\n");
+ client.println("Content-Type: text/csv");
+ client.println("Connection: close");
client.println();
// here's the actual content of the PUT request
diff --git a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino b/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
index 8a96367..e7eb275 100644
--- a/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
+++ b/libraries/GSM/examples/GsmWebClient/GsmWebClient.ino
@@ -2,8 +2,8 @@
Web client
This sketch connects to a website through a GSM shield. Specifically,
- this example downloads the URL "http://arduino.cc/" and prints it
- to the Serial monitor.
+ this example downloads the URL "http://arduino.cc/asciilogo.txt" and
+ prints it to the Serial monitor.
Circuit:
* GSM shield attached to an Arduino
@@ -34,7 +34,7 @@ GSM gsmAccess;
// URL, path & port (for example: arduino.cc)
char server[] = "arduino.cc";
-char path[] = "/";
+char path[] = "/asciilogo.txt";
int port = 80; // port 80 is the default for HTTP
void setup()
@@ -48,13 +48,13 @@ void setup()
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))
+ (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY))
notConnected = false;
else
{
@@ -72,7 +72,10 @@ void setup()
// Make a HTTP request:
client.print("GET ");
client.print(path);
- client.println(" HTTP/1.0");
+ client.println(" HTTP/1.1");
+ client.print("Host: ");
+ client.println(server);
+ client.println("Connection: close");
client.println();
}
else
@@ -91,7 +94,7 @@ void loop()
char c = client.read();
Serial.print(c);
}
-
+
// if the server's disconnected, stop the client:
if (!client.available() && !client.connected())
{