Esempio n. 1
0
 def __init__(self):
    launchPads = launchpad.findLaunchpads()
    print launchPads
    self.lp = launchpad.launchpad(*launchPads[-1])
    self.lp.reset()
    self.client = None
    self.running = True
Esempio n. 2
0
 def __init__(self):
     launchPads = launchpad.findLaunchpads()
     print launchPads
     self.lp = launchpad.launchpad(*launchPads[-1])
     self.lp.reset()
     self.client = None
     self.running = True
Esempio n. 3
0
	def __init__(self, xcount, ycount, simSize=4, xskip=2, yskip=1):
		self.xcount = xcount
		self.ycount = ycount
		self.xskip = xskip
		self.yskip = yskip

		# Set up launchpads
		launchPads = launchpad.findLaunchpads()
		if launchPads:
			if len(launchPads) != xcount * ycount:
				print "Found %s launchpads, expecting %s" % (len(launchPads), xcount * ycount)
			for l in launchPads:
				self.launchPadObjs.append(launchpad.launchpad(*l))
				self.launchPadObjs[-1].reset()
		else:
			# Use simulator
			import launchpadSim
			self.launchPadObjs = launchpadSim.setupMany(xcount, ycount, simSize, xskip, yskip)
Esempio n. 4
0
    def __init__(self, xcount, ycount, simSize=4, xskip=2, yskip=1):
        self.xcount = xcount
        self.ycount = ycount
        self.xskip = xskip
        self.yskip = yskip

        # Set up launchpads
        launchPads = launchpad.findLaunchpads()
        if launchPads:
            if len(launchPads) != xcount * ycount:
                print "Found %s launchpads, expecting %s" % (len(launchPads),
                                                             xcount * ycount)
            for l in launchPads:
                self.launchPadObjs.append(launchpad.launchpad(*l))
                self.launchPadObjs[-1].reset()
        else:
            # Use simulator
            import launchpadSim
            self.launchPadObjs = launchpadSim.setupMany(
                xcount, ycount, simSize, xskip, yskip)
Esempio n. 5
0
                if e[2]:
                    if self.mode == 0:
                        self.lp.light(e[0], e[1], 3, 3)
                    elif self.mode == 1:
                        self.lp.light(e[0], e[1], 3, 0)
                        for c in Test.FENCE:
                            self.lp.light(e[0] + c[0], e[1] + c[1], 3, 3)
                    elif self.mode == 2:
                        self.lp.ledTest(3)
                        self.lp.light(e[0], e[1], 0, 0)
                else:
                    if self.mode == 0:
                        self.lp.light(e[0], e[1], 0, 0)
                    elif self.mode == 1:
                        self.lp.light(e[0], e[1], 0, 0)
                        for c in Test.FENCE:
                            self.lp.light(e[0] + c[0], e[1] + c[1], 0, 0)
                    elif self.mode == 2:
                        self.lp.reset()
            time.sleep(0.01)


if __name__ == "__main__":

    launchPads = launchpad.findLaunchpads()
    l = launchpad.launchpad(*launchPads[-1])
    l.reset()

    t = Test(l, 1)
    t.run()
Esempio n. 6
0
#!/usr/bin/env python2.7
import launchpad
import time
import random

if __name__ == "__main__":
    launchPads = launchpad.findLaunchpads()
    launchPadObjs = []
    for l in launchPads:
        launchPadObjs.append(launchpad.launchpad(*l))
        launchPadObjs[-1].setDrumRackMode()

    #l.reset()
    #l.ledTest(1)

    while 1:
        x = random.randint(0, 8)
        y = random.randint(0, 8)

        r = int((x + time.time()) * 3 / 8) % 4
        g = int((y + time.time()) * 3 / 8) % 4

        launchPadObjs[0].light(x, y, r, g)
        launchPadObjs[1].light(x, 8 - y, r, g)
        launchPadObjs[2].light(8 - x, y, r, g)
        launchPadObjs[3].light(8 - x, 8 - y, r, g)
        time.sleep(0.001)