Hardware Reference
In-Depth Information
Figure 14-5:
The example
breadboard
layout for a
simple push-
button input
You don't need to import the time library, because this example doesn't need any timing
instructions. Instead, you can get right to enabling board mode and setting up Pin 12 as an
input. This is done in the same way as setting a pin as an output, with just the final part of
the instruction changed accordingly:
GPIO.setmode(GPIO.BOARD)
GPIO.setup(12, GPIO.IN)
If you're not using Pin 12 for this, make sure you change the pin number in the preceding
instruction.
Search WWH ::




Custom Search