Example showing the ublox Cellular GPS/GNSS module with the HTTPClient library to fetch and upload web pages.

Dependencies:   C027_Support HTTPClient mbed

Files at this revision

API Documentation at this revision

Comitter:
mazgch
Date:
Fri Jun 06 15:18:36 2014 +0000
Parent:
6:6ff6061a0f76
Child:
8:eea979594a37
Commit message:
use latest version of lib

Changed in this revision

C027_Support.lib Show annotated file Show diff for this revision Revisions of this file
HTTPClient.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/C027_Support.lib	Tue May 27 09:17:49 2014 +0000
+++ b/C027_Support.lib	Fri Jun 06 15:18:36 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/teams/ublox/code/C027_Support/#34985b4d821e
+http://mbed.org/teams/ublox/code/C027_Support/#3915192f6d7e
--- a/HTTPClient.lib	Tue May 27 09:17:49 2014 +0000
+++ b/HTTPClient.lib	Fri Jun 06 15:18:36 2014 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/donatien/code/HTTPClient/#1f743885e7de
+http://mbed.org/users/donatien/code/HTTPClient/#277279a1891e
--- a/main.cpp	Tue May 27 09:17:49 2014 +0000
+++ b/main.cpp	Fri Jun 06 15:18:36 2014 +0000
@@ -11,7 +11,7 @@
 /*! The APN of your network operator SIM, sometimes it is "internet" check your 
     contract with the network operator. You can also try to look-up your settings in 
     google: https://www.google.de/search?q=APN+list */
-#define APN         "gprs.swisscom.ch"
+#define APN         NULL
 //! Set the user name for your APN, or NULL if not needed
 #define USERNAME    NULL
 //! Set the password for your APN, or NULL if not needed
@@ -24,11 +24,33 @@
 {
     // turn on the supplies of the Modem
     MDMSerial mdm;
-    //mdm.setDebug(4); // enable this for debugging issues 
+    mdm.setDebug(4); // enable this for debugging issues 
     if (!mdm.connect(SIMPIN, APN,USERNAME,PASSWORD))
         return -1;
-    
     HTTPClient http;
+    {
+        char urlString[100] = "http://192.38.36.13/hanshenrik/GPRS/gprs.php?mode=";
+        char url[200];
+        char databuffer[100];
+        strcpy (url,urlString);
+        int id = 10;
+        float la = 10.0, lo = 20.0;
+        float pres = 30.0, temp = 40.0, o3 = 50.0;
+        int co2 = 200;
+        //sprintf(databuffer, "latitude&id=%d&data=%.5f", id, la); //This is a short URL that works!
+        sprintf(databuffer, "update&id=%d&lat=%.1f&lng=%.1f&pres=%.1f&temp=%.1f&co2=%d&o3=%.1f",id,la,lo,pres,temp,co2,o3);
+        printf("URL string: \"%s\"\r\n", url);
+        wait_ms(1000);
+        strcat(url, databuffer);
+        wait_ms(1000);
+        printf("URL string: \"%s\"\r\n", url);
+        wait_ms(1000);
+        int ret = http.get(url, str, 128);
+        wait_ms(1000);
+        printf("%d \"%s\"\r\n", ret, str);
+        wait_ms(1000);
+        while (1);
+    }       
     
     //GET data
     printf("\nTrying to fetch page...\n");