title: Raspberry Pi - Capture GPIO input and ignore others for 10 seconds
body: <p>So I've created the following code to capture input from three GPIO terminals of a Raspberry PI 3 B+. This code does what I want, EXCEPT there seems to be a buffer and the event_detect system that I want to clear once the first input becomes active.  The purpose of this program is for a game-show like experience of people trying to buzz in at the same time.  But there can only be one "first" person to buzz in. The program should detect the first active input and basically ignore the rest for 10 seconds.</p>
  
  <p>PS - I'm very novice to Python and the specifics of the Raspberry pi.</p>
  
  <p>PPS - I've reduced the timer to 3 seconds to make it easier to troubleshoot.</p>
  
  <pre><code># External module imports
  from guizero import App, Text, TextBox, PushButton
  import RPi.GPIO as GPIO
  import sys
  import time
  
  # This procedure will watch three inputs and lock in the team that calls in first for 10seconds
  # Change the colors of the buttons to show which team pressed in first.
  
  def action1(dunno):
          # Team1 button pressed
          team1_btn.bg="green"
          team2_btn.bg="red"
          team3_btn.bg="red"
          sleep10()
  
  def action2(dunno):
          # Team1 button pressed
          team1_btn.bg="red"
          team2_btn.bg="green"
          team3_btn.bg="red"
          sleep10()
  
  def action3(dunno):
          # Team1 button pressed
          team1_btn.bg="red"
          team2_btn.bg="red"
          team3_btn.bg="green"
          sleep10()
  
  def sleep10():
          #sleep for 10 seconds
          delay_timer.visible=True
          for i in range(3,0,-1):
                  delay_timer.value=str(i)
                  time.sleep(1)
          delay_timer.visible=False
          team1_btn.bg="light grey"
          team2_btn.bg="light grey"
          team3_btn.bg="light grey"
  
  
  # Pin setup
  GPIO.setmode(GPIO.BCM) # Broadcom pin-numbering scheme
  GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(20, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.setup(21, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  GPIO.add_event_detect(16, GPIO.RISING, callback=action1, bouncetime=1800)
  GPIO.add_event_detect(20, GPIO.RISING, callback=action2, bouncetime=1800)
  GPIO.add_event_detect(21, GPIO.RISING, callback=action3, bouncetime=1800)
  
  
  app = App(title="A07 DSS Tri-State - Jeopardy", width=700)
  blank1 = Text(app, text="")
  welcome_message = Text(app, text="This..      is..       Jeopardy!!", size=30, font="Times New Roman", color="blue")
  
  blank2 = Text(app, text="")
  blank3 = Text(app, text="")
  
  team1_btn = PushButton(app, text="Team Black &amp; Blue")
  team1_btn.bg="light grey"
  blank4 = Text(app, text="")
  team2_btn = PushButton(app, text="Team Holiday Spirit")
  team2_btn.bg="light grey"
  blank5 = Text(app, text="")
  team3_btn = PushButton(app, text="Team Creamsicle")
  team3_btn.bg="light grey"
  blank6 = Text(app, text="")
  delay_timer = Text(app, text="0")
  delay_timer.visible=False
  
  app.display()
  
  </code></pre>