title: Raspberry pi shutdown button with a delay
body: <p>I have a raspberry Pi that i had added an shutdown button on the GPIO using this script:</p>
  
  <pre><code>import RPi.GPIO as GPIO
  import os
  
  gpio_pin_number=21
  GPIO.setmode(GPIO.BCM)
  GPIO.setup(gpio_pin_number, GPIO.IN, pull_up_down=GPIO.PUD_UP)
  
  try:
      GPIO.wait_for_edge(gpio_pin_number, GPIO.FALLING)
      os.system("sudo shutdown -h now")
  except:
      pass
  
  GPIO.cleanup()
  </code></pre>
  
  <p>It works like a charm, but more than once i had pressed the button by accident, so to avoid this problem, i want to mod the script so it requires you to hold the button for N seconds instead just pressing it.</p>
  
  <p>So if any one can point me in the right direction (i'm not very good in python) i would be glad.</p>