Last active
June 28, 2019 14:56
-
-
Save rbricheno/8b7a3d40cbf6c44507fea8546ec155ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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