Example #1
0

# signal handler that resets the board when ctrl-c is pressed
def handleSignal(signal, frame):
    openwestkit.reset()
    sys.exit(0)


signal.signal(signal.SIGINT, handleSignal)

openwestkit = OpenWestKit()

openwestkit.reset()
brightness = 65
while (1):
    openwestkit.brightness(brightness)
    time.sleep(1)

    for code in openwestkit.readData():
        if code == 'a':
            brightness -= 5
        elif code == 'b':
            brightness += 5

    # max
    if brightness > 255:
        brightness = 255
    # min
    if brightness < 5:
        brightness = 5
Example #2
0
def init():
    """Returns an OpenWestKit object and makes the brightness tolerable. :)"""
    openwestkit = OpenWestKit()
    openwestkit.brightness(16) #16 doesn't blind me when I stare

    return openwestkit
Example #3
0
from openwestkit import OpenWestKit


# signal handler that resets the board when ctrl-c is pressed
def handleSignal(signal, frame):
    openwestkit.reset()
    sys.exit(0)

signal.signal(signal.SIGINT, handleSignal)

openwestkit = OpenWestKit()

openwestkit.reset()
brightness = 65
while(1):
    openwestkit.brightness(brightness)
    time.sleep(1)

    for code in openwestkit.readData():
        if code == 'a':
            brightness -= 5
        elif code == 'b':
            brightness += 5

    # max
    if brightness > 255:
        brightness = 255
    # min
    if brightness < 5:
        brightness = 5