Skip to content

Instantly share code, notes, and snippets.

@ChopsKingsland
Created February 12, 2022 13:36
Show Gist options
  • Save ChopsKingsland/0542b64b561958b087f6f3d4ea193c61 to your computer and use it in GitHub Desktop.
Save ChopsKingsland/0542b64b561958b087f6f3d4ea193c61 to your computer and use it in GitHub Desktop.
from gpiozero import Button
import time
point1 = Button(4)
point2 = Button(17)
point3 = Button(27)
point4 = Button(22)
point5 = Button(23)
point6 = Button(24)
point7 = Button(25)
point8 = Button(5)
point9 = Button(6)
point10 = Button(12)
point11 = Button(13)
point12 = Button(16)
while True:
if point1.is_pressed:
print("Button 1 is pressed")
time.sleep(1)
elif point2.is_pressed:
print("Button 2 is pressed")
time.sleep(1)
elif point3.is_pressed:
print("Button 3 is pressed")
time.sleep(1)
elif point4.is_pressed:
print("Button 4 is pressed")
time.sleep(1)
elif point5.is_pressed:
print("Button 5 is pressed")
time.sleep(1)
elif point6.is_pressed:
print("Button 6 is pressed")
time.sleep(1)
elif point7.is_pressed:
print("Button 7 is pressed")
time.sleep(1)
elif point8.is_pressed:
print("Button 8 is pressed")
time.sleep(1)
elif point9.is_pressed:
print("Button 9 is pressed")
time.sleep(1)
elif point10.is_pressed:
print("Button 10 is pressed")
time.sleep(1)
elif point11.is_pressed:
print("Button 11 is pressed")
time.sleep(1)
elif point12.is_pressed:
print("Button 12 is pressed")
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment