Exemplo n.º 1
0
def main():

    cube = Cube(8, SocketConnection(4444))
    t = 0

    cube.startFrame()

    for i in range(8):
        cube.turnOnLED(0,i,0)

    cube.endFrame()

    count = 0
    while True:
        cube.startFrame()
        
        t += 1

        for z in range(8):
            for y in range(8):
                x = int(round(3.5 + 3.5 * math.sin(z / 4.0 + y / 4.0 + t / 24)))
                cube.turnOnLED(x,y,z)

        cube.endFrame()
        time.sleep(.004)
Exemplo n.º 2
0
def main():
    """ Simple prompt program for displaying on the sim """

    c = Cube(8, SocketConnection(4444))

    prompt = ''
    c.startFrame()

    while prompt != 'exit':
        prompt = input('>')

        if 'SEND' in prompt:
            c.endFrame()
            c.startFrame()

        elif 'ON' in prompt:
            c.turnOnLED(*[int(n) for n in prompt[2:].split(',')])

        elif 'OFF' in prompt:
            c.turnOffLED(*[int(n) for n in prompt[3:].split(',')])

        elif 'WAIT' in prompt:
            time.sleep(int(prompt[4:]))

        elif 'EXIT' in prompt:
            break

        else:
            print('Error: Command not recognized')
Exemplo n.º 3
0
def main():

    cube = Cube(8, SocketConnection(4444))
    t = 0

    cube.startFrame()

    points = set()
    for blah in itertools.permutations([0,0,0,7,7,7], 3):
        points.add(blah[:3])

    for point in points:
        cube.turnOnLED(*point)


    cube.endFrame()