sudo apt-get install i2c-tools sudo apt-get install python-smbus sudo modprobe i2c-dev sudo modprobe i2c-bcm2708 sudo vim /etc/modules i2c-dev i2c-bcm2708 sudo vim /etc/modprobe.d/raspi-blacklist.conf # blacklist i2c-bcm2708 sudo i2cdetect -y 1 git clone https://github.com/jonco91/hover_raspberrypi.git sudo python Hover_example.py sudo python Hover_drum.py amixer -c 0 cset numid=3 1 amixer -c 0 cset numid=3 2 ahems = pygame.mixer.Sound('samples/ahems.wav') import time from Hover_library import Hover hover = Hover(address=0x42, ts=23, reset=24) try: while True: if (hover.getStatus() == 0): message = hover.getEvent() type(message) if (message == "01000010"): # West tap pass elif (message == "01010000"): # Center tap pass elif (message == "01001000"): # East tap pass elif (message == "01000001"): # South tap pass elif (message == "01000100"): # North tap pass elif (message == "00100010"): # Swipe right pass elif (message == "00100100"): # Swipe left pass elif (message == "00110000"): # Swipe down pass elif (message == "00101000"): # Swipe up pass hover.setRelease() time.sleep(0.0008) except KeyboardInterrupt: print "Exiting..." hover.end() except: print "Something has gone wrong..." hover.end() sudo apt-get install python-pip pip help sudo apt-get install libudev-dev sudo pip install python-uinput sudo modprobe uinput # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. snd-bcm2835 i2c-dev i2c-bcm2708 uinput import time import uinput device = uinput.Device ([uinput.KEY_P, uinput.KEY_I,]) time.sleep(1) device.emit_click(uinput.KEY_P) device.emit_click(uinput.KEY_I) device.emit_combo([uinput.KEY_LEFTALT, uinput.KEY_LEFTCTRL, uinput.KEY_DELETE]) import time from Hover_library import Hover hover = Hover(address=0x42, ts=23, reset=24) import uinput device = uinput.Device ([uinput.KEY_P, uinput.KEY_I,]) try: while True: if (hover.getStatus() == 0): message = hover.getEvent() type(message) if (message == "01000010"): # West tap pass elif (message == "01010000"): # Center tap pass elif (message == "01001000"): # East tap pass elif (message == "01000001"): # South tap pass elif (message == "01000100"): # North tap pass elif (message == "00100010"): # Swipe right device.emit_click(uinput.KEY_P) elif (message == "00100100"): # Swipe left device.emit_click(uinput.KEY_I) elif (message == "00110000"): # Swipe down pass elif (message == "00101000"): # Swipe up pass hover.setRelease() time.sleep(0.0008) #sleep for 1ms except KeyboardInterrupt: print "Exiting..." hover.end() except: print "Something has gone wrong..." hover.end() sudo python Hover_pi.py device = uinput.Device ([uinput.KEY_P, uinput.KEY_I,]) device = uinput.Device ([uinput.KEY_P, uinput.KEY_I, uinput.KEY_LEFTALT, uinput.KEY_F4,]) elif (message == "00110000"): # Swipe down pass elif (message == "00110000"): # Swipe down device.emit_combo ([uinput.KEY_LEFTALT, uinput.KEY_F4]) sudo python Hover_LXDEcontrol.py west east openbox --reconfigure import time from Hover_library import Hover hover = Hover(address=0x42, ts=23, reset=24) import uinput device = uinput.Device ([ uinput.KEY_LEFTALT, uinput.KEY_UP, uinput.KEY_DOWN, uinput.KEY_LEFT, uinput.KEY_RIGHT, ]) try: while True: if (hover.getStatus() == 0): message = hover.getEvent() type(message) if (message == "01000010"): # West tap pass elif (message == "01010000"): # Center tap pass elif (message == "01001000"): # East tap pass elif (message == "01000001"): # South tap pass elif (message == "01000100"): # North tap pass elif (message == "00100010"): # Swipe right device.emit_combo ([uinput.KEY_LEFTALT, uinput.KEY_RIGHT]) elif (message == "00100100"): # Swipe left device.emit_combo ([uinput.KEY_LEFTALT, uinput.KEY_LEFT]) elif (message == "00110000"): # Swipe down device.emit_combo ([uinput.KEY_LEFTALT, uinput.KEY_DOWN]) elif (message == "00101000"): # Swipe up device.emit_combo ([uinput.KEY_LEFTALT, uinput.KEY_UP]) hover.setRelease() time.sleep(0.0008) #sleep for 1ms except KeyboardInterrupt: print "Exiting..." hover.end() except: print "Something has gone wrong..." hover.end() sudo python Hover_LXDEcontrol.py sudo python Hover_LXDEcontrol.py&