Back to Parent

# gpioInterface.py
# main routin for controlling execution with button press


from gpiozero import Button
from signal import pause
from datetime import datetime

button = Button(2)
f = open("final.py", "r")
s = f.read()
f.close()


def capture():
    print(datetime.now().isoformat())
    exec(s)


button.when_pressed = capture

pause()
Click to Expand

Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0