
and analyzes different frames from a video to
detect motion. Here’s the code I used, motiontest.
py, to test if it worked:
You can play with the numbers on line 13 to
adjust the sensitivity if you need to.
6. PUT IT ALL TOGETHER
You now have all the pieces of your jigsaw puzzle:
a working camera, the ability to tweet, and the
ability to detect motion. Now you’ll put them all
together in the final code.
Create a new file in your Python editor called
birdbot.py, and import the camera, Twitter, and
math modules you need, along with the keys and
token from keys.py:
Next, add the code you need to detect motion,
followed by the code to connect to the ...