Sunday, January 29, 2012

Step Seven: Getting the Arduino Code Together

In this post, we'll finalize the code used with the Arduino.


As introduced in the previous post, we can easily use Google App Engine as a free datastore for this project.


The next step is getting the Arduino Temperature/Humidity Sensor, 7-Segment display and Ethernet Shield into one sketch, receiving a basic response from App Engine.

In order to do this we will:
1) Combine the previous sketches
2) Make app engine respond with the Temperature / Humidity included in the request.


Let's get started.


On the app-engine front, we'll simply want to make a request handler to respond with status code 200, and show the result in a header (for debugging purposes).

That request handler can be as simple as:



Stitching the three sketches together yields something like the following (read through the comments for specifics!):



Running this sketch yields the following output:


A few Notes:
-Most of the above sketch is comments / case handling for 3rd party libraries.
-If your sketch seems to hang on "connecting to server..." try restarting the sketch using the Arduino's on-board reset button.


In the next post, I will included the complete code used for Google App Engine. As of this moment, the Arduino / Hardware components are complete.

No comments:

Post a Comment