This program follows on from the standard Python Twitter experiments. The original inspriation for this whole experiement came from a @Rob Bishop (OCR) Raspberry Pi Recipe Card. The objective of the program is to light an LED every time a tweet containing a particular word is sent to a certain person.
We should also setup the GPIO objects and ensure we are using the correct pins.
Now comes the exciting bit where we can start checking for status updates that might indicate whether the LED should be turned on or off. You will notice at the bottom that I’m sleeping for quite alot longer than Rob’s version – Twitter seems to have added some limits on the number of calls in any one window – 15 in 15mins or for us 1 a minute. Ignore this and your program could error as it gets blocked until the 15min window expires.
And finally you should be good to run your program and any tweets sent by your user containing either LED-ON or LED-OFF should alter your LED.
sudo python tweetLED.py