Reed switch activated tweet with Agent/Xively

I’ve been working on a project inspired by IJLabs tweeting cat flap. This is my first attempt at something since Agents were introduced so it was back to being a total noob rather than a halfnoob…

As is usual for me I’ve cut, pasted and altered the hard work done by others and tried to figure out what all the code means and how it works by changing values and seeing what happens. (trial & error :slight_smile: )

Anyway the outcome is a tweet sent by a reed switch activation using Xively. It’s maybe not pretty but it works. One issue is that status updates can’t be repeated so each has to be unique - the only way round that I could see was to timestamp the tweet although it’s not coming up in h:m:s format but in (I think) a seconds counter

Thanks very much to those who have posted their code - Hugo & Joel Wehr for the Agent/Xively code and Brendan Dawes & IJLabs for the device code

To get it working you need a Xively account and a Twitter Developer account, once you have these you can paste the relevant key/secret details into the code

The Agent and Device code is in the attached files.

I’m using an Arduino shield and have the reed switch to pin7 and Gnd. I’m also using the LED on Pin9 to indicate switch operation.

Is there an easier (less code way) to do this?

Twitter feed at