Hardware Reference
In-Depth Information
Figure 2-5:
Wiring the toy
up to the
normally open
relay contacts.
Update the twitter_tag_listen.py code as follows:
Import your chicken and piface.pfio modules.
Create a Chicken object called chick and pass in the number of the output pins wired
up to the toy.
Instead of printing a tweet, start the chick wobbling, say the tweet, and then stop the
chick from wobbling.
The code for twitter_tag_listen.py is shown in full in Listing 2-1.
Listing 2-1 twitter_tag_listen.py
#!/usr/bin/env python
#twitter_tag_listen.py
#listens for new tweets containing a search term
#and then wobbles a chicken
import time
import sys
import twitter
import chicken
import piface.pfio as pfio
DEFAULT_SEARCH_TERM = “chicken” #what we search twitter for
TIME_DELAY = 30 # seconds between each status check
continued
Search WWH ::




Custom Search