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()
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':
# # INSTALLATION # Place the Hover_library.py file and the /gpio folder in the same directory as the Hover_example.py file. # Then run Hover_example.py by typing: python Hover_example.py # # SUPPORT # For questions and comments, email us at [email protected] # # ============================================================================================================ import time import logging as log from Hover_library import Hover hover = Hover(address=0x42, ts="gpio2", reset="gpio4") 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, print "= " + hover.getEventString(event) #This line can be commented out if you don't want to see the event in text format # Release the ts pin until Hover is ready to send the next event
def __init__(self, synth): self.hover = Hover(address=0x42, ts=4, reset=17) self.device = synth
#the Calebrator's sound card is alsa's default output #device fs.start(driver='alsa') #NOTE: These print statements won't be seen unless a display #is hooked up to the Calebrator via the HDMI port print("Started FluidSynth") #Loading a soundfont for fluidsynth to use sfid = fs.sfload("guitar.sf2") #Select the program with the desired soundfont fs.program_select(0, sfid, 0, 0) print("Loaded soundfont") hover = Hover(address=0x42, ts=4, reset=17) ######################################################################## ######################### All of the commands ########################## ######################################################################## #Plays an instance of the C note def playButton1(): global switch1 global switch2 global switch3 if (switch1 == 1): fs.noteon(0, 48, 100) print("Button 1 (C4): On")
# # HISTORY # v1.0 - Initial Release # # INSTALLATION # Place the Hover_library.py file in the same folder as the Hover_example.py file. # Then run Hover_example.py by typing: sudo python Hover_example.py # # SUPPORT # For questions and comments, email us at [email protected] import pygame import time from Hover_library import Hover hover = Hover(address=0x42, ts=23, reset=24) pygame.mixer.init() kick = pygame.mixer.Sound('samples/kick.wav') 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:
# HISTORY # v1.0 - Initial Release # # INSTALLATION # Place the Hover_library.py file in the same folder as the Hover_example.py file. # Then run Hover_example.py by typing: sudo python Hover_example.py # # SUPPORT # For questions and comments, email us at [email protected] # # ============================================================================================================ import time 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, print "= " + hover.getEventString( event ) #This line can be commented out if you don't want to see the event in text format
# HISTORY # v1.0 - Initial Release # # INSTALLATION # Place the Hover_library.py file in the same folder as the Hover_example.py file. # Then run Hover_example.py by typing: sudo python Hover_example.py # # SUPPORT # For questions and comments, email us at [email protected] import pygame import time from Hover_library import Hover hover = Hover(address=0x42, ts=23, reset=24) pygame.mixer.init() kick = pygame.mixer.Sound('samples/kick.wav') 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: