def handleTouch(channel): touchData = mpr121.readWordData(0x5A) for i in xrange(12): if touchData & (1 << i): # print( 'Pin ' + str(i) + ' was just touched') sounds[i].play() else: pass
def handle_touch(channel): touchData = mpr121.readWordData(0x5a) if not pygame.mixer.get_busy(): # if no sound is playing for i in xrange(num_pins): if (touchData & (1<<i)): sound_set.play_pin(i + 1)