Example code from the SparkFun Inventor's Kit Guide.