def main(): lp = launchpad.LaunchpadMk2() if lp.Open(0, "mk2"): print(" - Launchpad Mk2: OK") else: print(" - Launchpad Mk2: ERROR") return lp.ButtonFlush() for x in range(8): for y in range(1, 9): lp.LedCtrlXYByRGB(x, y, list(img[y - 1, x])) print("Entering main loop. Press Control-C to exit.") try: while True: time.sleep(1) except KeyboardInterrupt: print('') finally: print("Exit.") lp.Reset() lp.Close()
def main(): lp = launchpad.LaunchpadMk2() if lp.Open(0, "mk2"): print(" - Launchpad Mk2: OK") else: print(" - Launchpad Mk2: ERROR") return img = cv.imread('img/8x8_rgb.png', cv.IMREAD_COLOR) img = cv.cvtColor(img, cv.COLOR_BGR2RGB) lp.ButtonFlush() for x in range(8): for y in range(1, 9): lp.LedCtrlXYByRGB(x, y, list(img[y - 1, x] // 4)) print("Entering main loop. Press Control-C to exit.") try: while True: time.sleep(1) except KeyboardInterrupt: print('') finally: print("Exit.") lp.Reset() lp.Close()
def main(): lp = launchpad.LaunchpadMk2() if lp.Open(0, "mk2"): print(" - Launchpad Mk2: OK") else: print(" - Launchpad Mk2: ERROR") return lp.ButtonFlush() lp.LedCtrlXYByRGB(0, 1, [63, 0, 0]) # Red lp.LedCtrlXYByRGB(7, 1, [0, 63, 0]) # Green lp.LedCtrlXYByRGB(0, 8, [0, 0, 63]) # Blue lp.LedCtrlXYByRGB(7, 8, [63, 63, 63]) # White print("Entering main loop. Press Control-C to exit.") try: while True: time.sleep(1) except KeyboardInterrupt: print('') finally: print("Exit.") lp.Reset() lp.Close()
def main(): lp = launchpad.LaunchpadMk2() if lp.Open(0, "mk2"): print(" - Launchpad Mk2: OK") else: print(" - Launchpad Mk2: ERROR") return lp.midi.devIn.set_callback(MidiInputHandler()) lp.midi.devIn.ignore_types(sysex=False) lp.midi.RawWriteSysEx([126, 127, 6, 1]) time.sleep(0.005) lp.Close()
def main(): lp = launchpad.LaunchpadMk2() if lp.Open(0, "mk2"): print(" - Launchpad Mk2: OK") else: print(" - Launchpad Mk2: ERROR") return lp.ButtonFlush() lp.LedAllOn(5) time.sleep(1) lp.Reset() lp.Close()
def main(): lp = launchpad.LaunchpadMk2() if lp.Open(0, "mk2"): print(" - Launchpad Mk2: OK") else: print(" - Launchpad Mk2: ERROR") return lp.midi.devIn.set_callback(MidiInputHandler(lp)) print("Entering main loop. Press Control-C to exit.") try: while True: time.sleep(1) except KeyboardInterrupt: print('') finally: print("Exit.") lp.Reset() lp.Close()