Dec-21-2017, 03:41 PM
Hi,
I have developed a small standalone device using Pi 3 and Python.
Basically it's 5 buttons that activate a countdown timer for 5 different time lapses.
(Like you would use in interval training) Time shows on a 2x16 lcd.
As these buttons are used randomly, there are 5 separate 'if event_detect(...'
waiting in an ever spinning While loop, (One for each GPIO pin)
All this works (fine). A sixth button does a shutdown -h...
But i am wondering if there is a more elegant way of doing this, because very
soon i may need 10 event_detects...with 10 if statements.
What other coding method, if any, a part from this ever spinning while loop,
could there be to achieve this? Basically it's waiting for random input from any number of GPIO pins.
thx,
Paul
I have developed a small standalone device using Pi 3 and Python.
Basically it's 5 buttons that activate a countdown timer for 5 different time lapses.
(Like you would use in interval training) Time shows on a 2x16 lcd.
As these buttons are used randomly, there are 5 separate 'if event_detect(...'
waiting in an ever spinning While loop, (One for each GPIO pin)
All this works (fine). A sixth button does a shutdown -h...
But i am wondering if there is a more elegant way of doing this, because very
soon i may need 10 event_detects...with 10 if statements.
What other coding method, if any, a part from this ever spinning while loop,
could there be to achieve this? Basically it's waiting for random input from any number of GPIO pins.
thx,
Paul