Hardware Reference
In-Depth Information
2. On the last line add the following line, which will call your graph-drawing function:
drawgraph.drawGraph(outwardTimes, “birdGraph.pdf”)
3. Finally, test that your program produces a graph by running it:
cat birddata.txt | python analyseBirdDataFiltered.py
Your program should produce a PDF with a chart showing bird activity. You can view the
PDF on the Raspberry Pi with the command xpdf . If xpdf is not installed, install it with
apt-get as follows:
apt-get install xpdf
To view the chart on the Raspberry Pi with the graphical environment running (type startx
if it is not), into a terminal type
xpdf birdGraph.pdf
Putting the Nest Box into Service
With all the code written and tested, it is time to get your Raspberry Pi in service gathering
real data on wildlife. Before deploying you need to remove the test data by deleting the
birddata.txt ile. To delete a ile from the command line, you can type rm filename .
Mount the Raspberry Pi and nest box securely and start the recordBird.py logging pro-
gram running. You can check for bird activity by looking for entries in the birddata.txt
log ile with the more command.
Hopefully you'll see some activity, after which you can analyse the data by running the
analyseBirdDataFiltered.py program.
Over to You
With your nest box gathering valuable information about the habits of the birds in your gar-
den, it is worth considering how you can take things further. Some of these suggestions are
simple to implement; you can reuse code from other chapters of the topic. Others are more
involved and will require further research.
Search WWH ::




Custom Search