Skip to content

Instantly share code, notes, and snippets.

@rbricheno
Last active June 28, 2019 14:56
Show Gist options
  • Save rbricheno/8b7a3d40cbf6c44507fea8546ec155ad to your computer and use it in GitHub Desktop.
Save rbricheno/8b7a3d40cbf6c44507fea8546ec155ad to your computer and use it in GitHub Desktop.
from guizero import App, Text
from gpiozero import Button
button = Button(2)
app = App(title="Hello GPIO")
message = Text(app, text="Waiting for first update")
def pressed_button():
message.value = "Button is pressed"
def released_button():
message.value = "Button is not pressed"
# Add events
button.when_pressed = pressed_button
button.when_released = released_button
app.display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment