Guest User

GPIO17Escape

a guest
Mar 23rd, 2013
47
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2. import RPi.GPIO as GPIO
  3. import uinput
  4. events=(uinput.KEY_ESC,)
  5. device=uinput.Device(events)
  6. GPIO.setmode(GPIO.BCM)
  7. GPIO.setup(17, GPIO.IN)
  8. while True:
  9.     button=GPIO.input(17)
  10.     if button==False:
  11.         device.emit(uinput.KEY_ESC,1)
  12.         device.emit(uinput.KEY_ESC,0)
  13.         while button==False:
  14.             button=GPIO.input(17)
RAW Paste Data