Hardware Reference
In-Depth Information
// Close connection and disconnect
client.close();
Serial.println(F( "Disconnecting" ));
Serial.println(F( "" ));
cc3000.disconnect();
After that, we also disable the watchdog:
wdt_disable();
Finally, we repeat this loop again after 10 seconds. Note that you can customize this delay
if you want less frequent measurements:
delay( 10000 );
Note that the complete code for this chapter can be found on the corresponding folder in-
side the GitHub repository of the topic:
https://github.com/openhomeautomation/iot-book
We are now going to test this code. Make sure that you entered the name of your thing
inside the sketch, and that you also entered the data for your WiFi network. Then, upload
the code to the Arduino board. Open the Serial monitor, and after a while you should see
the answer coming back from the dweet.io server:
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 174
Date: Thu, 24 Jul 2014 12:08:32 GMT
Connection: keep-alive
{"this":"succeeded","by":"dweeting","the":"dweet","with":
{"thing":"yourThingName","created":"2014-07-24T12:08:32.443Z",
"content":{"temperature":25,"humidity":35,"light":59}}}
You can also check online that the data was correctly recorded. Just type in a browser:
Search WWH ::




Custom Search