def changeSpeed(code, speed):
    if code == 'a':  # button 1 was pressed, speed up
        speed -= .05
    elif code == 'b':  # button 2 was pressed, slow down
        speed += .05

    # Safety check as we can't sleep for less than zero time
    if speed <= 0:
        speed = .05

    return speed


openwestkit = OpenWestKit(debug=True)

speed = 1
while (1):
    for pixelNum in range(0, 4):

        # Pick a random color
        r, g, b = random.randrange(255), random.randrange(
            255), random.randrange(255)

        openwestkit.setPixel(pixelNum, r, g, b)
        for code in openwestkit.readData():
            speed = changeSpeed(code, speed)

        print "Current speed", speed
예제 #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
예제 #3
0
import urllib2
import base64
import webbrowser
from xml.dom.minidom import parse, parseString
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()

# programming logic begins

new_emails = False
# store the first email link
first_entry_link = None

gmail_username = ""
gmail_password = ""
gmail_atom_feed_url = "https://mail.google.com/mail/feed/atom"

global_count = 0

angle_step = .05  # reduce the step to make the glow seq slower
angle = 0