User manual

You can write each setup statement, or create a loop to do all four. Next, add a routine that
checks each input and writes its value to the console:
def CheckSwitch ():
val1 = not GPIO.input(4)
val2 = not GPIO.input(23)
val3 = not GPIO.input(10)
val4 = not GPIO.input(9)
print val1,val2,val3,val4
I added the ‘not’ operation so that push-button presses show up as ‘True’, rather than
‘False’. Finally, re-check once per second, until the user (you) are satisfied with the result:
while (True):
CheckSwitch()
time.sleep(1)
Run it, and try pressing any combination of pushbuttons. Hit Ctrl-C when you are satisfied
each input is working correctly.
Thats all for now. In Part 2 of this series we will display data on the LCD.