Hardware Reference
In-Depth Information
#Time taken is difference between times
elapsedTime = stopTime-startTime
#Display the time taken. str is required to convert
#elapsedTime into a string for printing
print “Your reaction time was: “ + str(elapsedTime)
#Turn LED off when finished
pfio.digital_write(1,0)
Run the code by pressing F5 from IDLE.
All the lights will go out. Wait until the LED comes on and then press button 0 as fast as you
can. he program will print your reaction time.
Next, you'll see if your reactions are any faster with a big red button as you wire up a simple
circuit.
Meet PiFace Digital's Connections
he PiFace Digital interface makes it very easy to wire up simple digital circuits so that you
can connect your Raspberry Pi to switches and actuators like lights or motors in the real
world. Figure 9-5 labels the connectors on PiFace Digital.
Figure 9-5:
PiFace Digital's
connectors.
Search WWH ::




Custom Search