Tweeting Arduinos
A useful and interesting hardware kit is Botanicalls.
a
It checks whether your plants
need water, and if they do, it sends a reminder message via http://twitter.com/. As
soon as you water the plant, Botanicalls dutifully sends a “Thank You” message.
Although the official version of Botanicalls is a specialized piece of hardware, you can
build it using an Arduino.
b
Botanicalls certainly make your life easier. Whether the Tweeting Vending Machine
c
improves your life is a matter of taste. Users of this modified vending machine have
to identify themselves using an RFID card. Whenever they buy some sweets, the
vending machine Tweets their name and what they’ve bought.
a.
http://www.botanicalls.com/
b.
http://www.botanicalls.com/archived_kits/twitter/
c.
http://www.popsugar.com/tech/Tweeting-Vending-Machine-34558986
credentials. Finally, we invoke
updateStatus
. If everything went fine, we print a
success message to the console. If anything goes wrong,
updateStatus
will raise
an exception, and we’ll print its stack trace for debugging purposes.
That’s all the code we need, so connect your Arduino to your PC and run it!
The following figure shows what happens on Twitter when the temperature
in my working room is higher than 32 degrees Celsius. (For your first tests,
you might have to change
32.0
to a smaller value. If you don’t have to change
it, why aren’t you at the beach?)
Using a full-blown PC as an Internet relay for your Arduino is convenient,
but it’s also overkill for most applications. In the next section, you’ll learn
how to turn an Arduino into a real networking device.
Chapter 10. Networking with Arduino • 172
report erratum • discuss
www.it-ebooks.info