Esempio n. 1
0
class GesturePad():
    def __init__(self, synth):
        self.hover = Hover(address=0x42, ts=4, reset=17)
        self.device = synth

    def close(self):
        self.hover.end()

    def check(self):
        if self.hover.getStatus() == 0:
            event = self.hover.getEvent()
            if event is not None:
                self.device.pitch_bend(0, 0 + 4096)
                sleep(1)
                self.device.pitch_bend(0, 4096 - 4096)
            self.hover.setRelease()
Esempio n. 2
0
import time
import subprocess
from Hover_library import Hover

hover = Hover(address=0x42, ts=23, reset=24)

try:
    while True:

        # Check if hover is ready to send gesture or touch events
        if (hover.getStatus() == 0):

            # Read i2c data and print the type of gesture or touch event
            event = hover.getEvent()

            if event is not None:
                print event,
                # This line can be commented out if you don't want to see the
                # event in text format
                try:
                    direction = hover.getEventString(event)
                except:
                    print "Invalid input recieved from hover, ignoring."
                    direction = ''

                print direction

                if direction == 'swipe_left':
                    print 'left'
                    subprocess.Popen(['bash', '-c', 'xdotool key --window "$(xdotool search --class --onlyvisible Chromium | head -n 1)" Up'])
                elif direction == 'swipe_right':
Esempio n. 3
0
clap = pygame.mixer.Sound('samples/clap.wav')
cymbal = pygame.mixer.Sound('samples/cymbal.wav')
snare = pygame.mixer.Sound('samples/snare.wav')
champion = pygame.mixer.Sound('samples/champion.wav')
closed = pygame.mixer.Sound('samples/closed.wav')
ahems = pygame.mixer.Sound('samples/ahem.wav')
doit = pygame.mixer.Sound('samples/doit.wav')
force = pygame.mixer.Sound('samples/force.wav')

try:
    while True:

        # Check if hover is ready to send gesture or touch events
        if (hover.getStatus() == 0):
            # Read i2c data and print the type of gesture or touch event
            message = hover.getEvent()
            type(message)
            if (message == "01000010"):
                kick.play()  #west
            elif (message == "01010000"):
                snare.play()  #center
            elif (message == "01001000"):
                closed.play()  #east
            elif (message == "01000001"):
                cymbal.play()  #south
            elif (message == "01000100"):
                clap.play()  #north
            elif (message == "00100010"):
                champion.play()  #swipe right
            elif (message == "00100100"):
                ahems.play()  #swipe left
Esempio n. 4
0
clap = pygame.mixer.Sound('samples/clap.wav')
cymbal = pygame.mixer.Sound('samples/cymbal.wav')
snare = pygame.mixer.Sound('samples/snare.wav')
champion = pygame.mixer.Sound('samples/champion.wav')
closed = pygame.mixer.Sound('samples/closed.wav')
ahems = pygame.mixer.Sound('samples/ahem.wav')
doit = pygame.mixer.Sound('samples/doit.wav')
force = pygame.mixer.Sound('samples/force.wav')

try: 
  while True:

    # Check if hover is ready to send gesture or touch events
    if (hover.getStatus() == 0):
      # Read i2c data and print the type of gesture or touch event
      message = hover.getEvent() 
      type(message)
      if (message == "01000010"):  
        kick.play()  #west
      elif (message == "01010000"):
        snare.play() #center
      elif (message == "01001000"):
        closed.play() #east
      elif (message == "01000001"):
        cymbal.play() #south
      elif (message == "01000100"):
        clap.play() #north
      elif (message == "00100010"):
        champion.play() #swipe right
      elif (message == "00100100"):
        ahems.play() #swipe left