Patched version of sample code from here: http://learn.adafruit.com/minipov3/download