Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

esc-button.py 420B

12345678910111213141516171819202122
  1. #!/usr/bin/env python
  2. from RPi import GPIO
  3. import time
  4. from subprocess import call
  5. GPIO.setmode(GPIO.BCM)
  6. GPIO.setup(3, GPIO.IN)
  7. pressed = False
  8. while True:
  9. current = not GPIO.input(3)
  10. if current and not pressed:
  11. call(["xdotool", "keydown", "Escape"])
  12. pressed = True
  13. elif not current and pressed:
  14. call(["xdotool", "keyup", "Escape"])
  15. pressed = False
  16. time.sleep(0.1)