I am trying to make a 'game' while learning about both Python and GPIO on the Raspberry Pi. This is what I have ATM:
while playing == 1:
if (GPIO.input(9) == 0):
GPIO.output(18, GPIO.LOW)
print("Well done!!")
time.sleep(1)
else:
print("Wrong!")
lives = lives - 1
time.sleep(1)
playing = 0
Now, my problem is that the program is hitting the if statement and is going straight to the else (as you would expect), however, I want the program to wait on the first part of the if statement for a second, then go to the else.
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire