Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1275

Python • Re: Wait for 2 Buttons to be pressed.

$
0
0
I may be reading this wrong but if you want
I want the Python script to wait for either one of them being pressed.
and to keep going I think you need an additional inner loop

Code:

while True:        button_1_selected = False    button_5_selected = False        while not(button_1_selected) and not(button_5_selected)            if button1.is_pressed == True:            button1.wait_for_release()            button_1_selected = True            if button5.is_pressed == True:            button5.wait_for_release()            button_5_selected = True                  # End of While no button selected         # Code to execute for button pressed    # End of while True Loop

Statistics: Posted by DS256 — Mon Mar 24, 2025 5:08 pm



Viewing all articles
Browse latest Browse all 1275

Trending Articles