Skip to content

Instantly share code, notes, and snippets.

@rbricheno
Last active June 28, 2019 14:56
Show Gist options
  • Save rbricheno/d015ce8cd466cf2902bbbae5309ec740 to your computer and use it in GitHub Desktop.
Save rbricheno/d015ce8cd466cf2902bbbae5309ec740 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 update_button():
if button.is_pressed:
message.value = "Button is pressed"
else:
message.value = "Button is not pressed"
# Update every 100ms, you might want to go faster.
text.repeat(100, update_button)
app.display()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment