Unmodified sample code from adafruit.