Skip to content

Commit

Permalink
Add example program (janky, look at next sprint)
Browse files Browse the repository at this point in the history
  • Loading branch information
Snarr committed Mar 5, 2024
1 parent 57f3d07 commit a34b55b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions examples/PygameZero_GPIOZero_Button_Example.py
@@ -0,0 +1,23 @@
from gpiozero import Button
import pgzrun

WIDTH = 300
HEIGHT = 300

button = Button(2)

screen_text = ""

def update():
if button.is_pressed:
screen_text = "Pressed"

def draw():
if button.is_pressed:
screen_text = "Pressed"
else:
screen_text = "Not Pressed"
screen.clear()
screen.fill((255, 255, 255))
screen.draw.text(screen_text, fontsize=40, center=(150, 150), color=(0,0,0))
pgzrun.go()

0 comments on commit a34b55b

Please sign in to comment.