Skip to content

Instantly share code, notes, and snippets.

@ranbogmord
Created December 6, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ranbogmord/df6ea8924e4a7cbba038 to your computer and use it in GitHub Desktop.
Save ranbogmord/df6ea8924e4a7cbba038 to your computer and use it in GitHub Desktop.
Blinks lights on a Launchpad Mini
from subprocess import call
from time import sleep
from random import randint
device_name = "hw:1"
loop_through = [
00, 01, 02, 03, 04, 05, 06, 07,
10, 11, 12, 13, 14, 15, 16, 17,
20, 21, 22, 23, 24, 25, 26, 27,
30, 31, 32, 33, 34, 35, 36, 37,
40, 41, 42, 43, 44, 45, 46, 47,
50, 51, 52, 53, 54, 55, 56, 57,
60, 61, 62, 63, 64, 65, 66, 67,
70, 71, 72, 73, 74, 75, 76, 77
]
colors = [
"0F", "3F", "3E", "3C"
]
while True:
for slot in loop_through:
color = colors[randint(0,3)]
call(["amidi", "-p", device_name, "-S", "90 " + str(slot) + " " + color])
sleep(0.02)
call(["amidi", "-p", device_name, "-S", "90 " + str(slot) + " 0C"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment