[foxxjnm] tracks his office temperature with ThingSpeak. He had a temperature probe and a FEZ Cobra development board lying around, so he decided to connect them to the ThingSpeak API.
I have been playing around with the ThingSpeak API a little this week. I decided to get my FEZ Cobra reporting temperature data from my office at work. Why a temperature sensor you ask?… Because I had one laying around.. That was good enough for me, guess I’m simple like that.
[via codefox blog]
4 CommentsOldest to Newest
I’d like do do something similar on the FEZ Cobra.
Would you share the code of the office temperature project ? (I’m only interested in the part that talks to ThingSpeak)
The part that talks to TS is very simple:
if (lastUpdate.Ticks < DateTime.Now.Subtract(new TimeSpan(0, 0, 300)).Ticks)
using (HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://api.thingspeak.com/update?key="+APIKey+"&field1=" + t.GetTemperatureFahrenheit().ToString()))
using (HttpWebResponse res = (HttpWebResponse)req.GetResponse())
using (StreamReader sr = new StreamReader(res.GetResponseStream()))
response = sr.ReadToEnd();
if (response != "")
lastUpdate = DateTime.Now;
If you need more than this, or any explanation, please feel free to let me know.
The link to the entire project is on my download page: http://foxxjnm.wordpress.com/downloads/
Thanks for providing the information for your excellent project!