Hardware Reference
In-Depth Information
Figure 10-5:
Wiring the toy
up to the
normally open
relay contacts.
Update the twitter_tag_listen.py code to control the hardware and speak as follows:
1. Import your chicken and piface.pfio modules.
2. Create a Chicken object called chick and pass in the number of the output pins wired
up to the toy.
3. Instead of printing a tweet, add three statements to start the chick wobbling, say the
tweet and then stop the chick from wobbling.
he code for twitter_tag_listen.py is shown in full in Listing 10-1, with the necessary
updates in bold.
Listing 10-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
 
Search WWH ::




Custom Search