Sample code for connecting u-blox c027 to AerCloud
Dependencies: C027_Support_AerCloud HTTPClient_AerCloud mbed
Fork of HTTPClient_Cellular_HelloWorld by
Diff: main.cpp
- Revision:
- 8:eea979594a37
- Parent:
- 7:b14d0f112a73
- Child:
- 9:cd98ff458412
--- a/main.cpp Fri Jun 06 15:18:36 2014 +0000 +++ b/main.cpp Fri Jun 13 06:39:40 2014 +0000 @@ -28,30 +28,7 @@ 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"); int ret = http.get("http://mbed.org/media/uploads/donatien/hello.txt", str, 128);