Python program with multiple inputs with a timer -


from gpiozero import button, led time import time, sleep random import randint

led = led(17) btn = button(27)

while true:

btn.wait_for_release() start = time() led.on() btn.wait_for_press() end = time() led.off()   print(end-start, 'seconds') 

how make wait button press , if not pressed within x seconds other function executed. if pressed before x seconds function executed.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -