![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
checking temperature and display it on phant server.
Dependencies: NetServices-Traffic mbed
Fork of Tweeting_Periodic_Room_Temperature by
Diff: main.cpp
- Revision:
- 2:46aa4f29041c
- Parent:
- 1:c1df4cf13f16
--- a/main.cpp Sun Feb 22 12:02:41 2015 +0000 +++ b/main.cpp Fri Jun 05 12:32:30 2015 +0000 @@ -5,11 +5,13 @@ Serial pc(USBTX, USBRX); // networking stuff EthernetNetIf eth; -NTPClient ntp; +//NTPClient ntp; HTTPClient http; -char* thingSpeakUrl = "https://api.thingspeak.com/apps/thingtweet/1/statuses/update"; -char* thingSpeakKey = "Z0EQH6OQ8HLNNL6G"; +//char* thingSpeakUrl = "https://api.thingspeak.com/apps/thingtweet/1/statuses/update"; +//char* thingSpeakKey = "Z0EQH6OQ8HLNNL6G"; +char* Public_Key = "4Jr0430jxDi7r9zmpv64"; +char* Private_Key = "b5KBzABxbWuKGjdBlMnm"; char urlBuffer[256]; char timeBuffer[64]; @@ -22,13 +24,13 @@ pc.printf("Start\r\n"); pc.printf("Setting up Ethernet...\r\n"); - EthernetErr ethErr = eth.setup(); + EthernetErr ethErr = eth.setup(); if(ethErr) { pc.printf("Error %d in ethernet setup.\r\n", ethErr); return -1; } - pc.printf("Ethernet setup OK\r\n"); + pc.printf("Ethernet setup OK\r\n"); while(1) { @@ -40,7 +42,8 @@ // format url here urlBuffer[0] = 0; - sprintf(urlBuffer, "%s?api_key=%s&status= %s %f", thingSpeakUrl, thingSpeakKey, "Temperature",temperature); + //sprintf(urlBuffer, "%s?api_key=%s&status= %s %f", thingSpeakUrl, thingSpeakKey, "Temperature",temperature); + sprintf(urlBuffer,"http://data.sparkfun.com/input/%s?private_key=%s&temp=%f", Public_Key, Private_Key, temperature); pc.printf("Request to %s\r\n", urlBuffer); HTTPText resp;