off = (0.0, 0.0, 0.0) #We define three states the lights can be in half = (0.0, 512.0, 0.0) green = (0.0, 1023.0, 0.0) pix = [] #Set up data structures that hold light information x_vals = Queue(maxsize=tailsize) y_vals = Queue(maxsize=tailsize) out = FadeAnimation() #Set up the fade animation out.FADERATE = 1.0 out.start() for i in range(MAX_X * MAX_Y): pix.append(off) #Turns Off all Lights x_vals.put(green_x) #Put the first light on the array and turns it on y_vals.put(green_y) pix[(green_y * MAX_X) + green_x] = green out.write(pix) while True: time.sleep(1 / speed) #Sleeps to keep the animation running at speed green_dir_x = check_speed(green_x, green_dir_x, MAX_X) #Find the next direction we're going green_dir_y = check_speed(green_y, green_dir_y, MAX_Y) pix[(green_y * MAX_X) + green_x] = half #Set the last light to half if x_vals.full( ): #If we're at tailsize, we turn off the last light in the tail pix[(y_vals.get() * MAX_X) + x_vals.get()] = off green_x += green_dir_x #Set coordinates to the next light green_y += green_dir_y if (green_x == 0 and green_y == 0) or (green_x == MAX_X - 1 and green_y == MAX_Y - 1):
print temp + "F" print conditions if __name__ == "__main__": import time out = FadeAnimation() pix = [(0.0,0.0,0.0)] * 24 out.FADERATE = 10.0 out.start() while True: #Rain if conditions.find("Rain") > -1: if random.randint(0,5) < 3: pix[random.randint(0,23)] = (0.0,0.0,1023.0) out.write(pix) for i in xrange(24): if pix[i][2] > 0.0: pix[i] = (0.0,0.0,pix[i][2] - 50.0) else: pix[i] = (0.0,0.0,0.0) time.sleep(severe) #Thunder elif conditions.find("Thunder") > -1: count+=1 if random.randint(0,5) < 3: pix[random.randint(0,23)] = (0.0,0.0,1023.0) if conditions.find("storm") > -1 and count > 5: l1= random.randint(0,23) pix[l1]= (1023.0,1023.0,0.0)
#!/usr/bin/env python import sys, random from animations import FadeAnimation red = (1023.0,0.0,0.0) white = (1023.0,1023.0,1023.0) blue = (0.0,0.0,1023.0) flag = [white, red, white, blue, blue, blue, white, red, white, blue, blue, blue, white, red, white, blue, blue, blue, white, red, white, blue, blue, blue, white, red, white, red, white, red, white, red, white, red, white, red, white, red, white, red, white, red, white, red, white, red, white, red] if __name__ == "__main__": import time out = FadeAnimation() out.start() while True: out.write(flag) time.sleep(1.0)
def pushcolor(color): time.sleep(1.0) pixels[0] = color out.write(pixels) time.sleep(1.0) random.shuffle(pixels) pixels[0] = black out.write(pixels) if __name__ == "__main__": password = "******" out.start() out.write(pixels) while True: M = imaplib.IMAP4_SSL('imap.gmail.com') try: rv, data = M.login(EMAIL_ACCOUNT, password) except imaplib.IMAP4.error: sys.exit(1) rv, mailboxes = M.list() rv, data = M.select(EMAIL_FOLDER) if rv == 'OK': rv, data = M.search(None, "ALL") if rv != 'OK': M.close() sys.exit(1) numcolors = 0 for num in data[0].split():
if __name__ == "__main__": import time init() out = FadeAnimation() out.start() twoback = {} oldpix = {} while True: pix = [] alive = 0 for i in xrange(6): for j in xrange(4): if board[(i,j)] > 0: pix.append((1023.0,0.0,0.0)) alive += 1 else: pix.append((0.0,0.0,1023.0)) out.write(pix) update() time.sleep(0.3) if alive == 0 or oldpix == board or twoback == board: out.write([(0.0,1023.0,0.0)] * 24) time.sleep(0.4) init() twoback = oldpix.copy() oldpix = board.copy()
if __name__ == "__main__": import time init() out = FadeAnimation() out.start() twoback = {} oldpix = {} while True: pix = [] alive = 0 for i in xrange(6): for j in xrange(8): if board[(i,j)] > 0: pix.append((1023.0,0.0,0.0)) alive += 1 else: pix.append((0.0,0.0,1023.0)) out.write(pix) update() time.sleep(0.3) if alive == 0 or oldpix == board or twoback == board: out.write([(0.0,1023.0,0.0)] * 24) time.sleep(0.4) init() twoback = oldpix.copy() oldpix = board.copy()
def pushcolor(color): time.sleep(1.0) pixels[0] = color out.write(pixels) time.sleep(1.0) random.shuffle(pixels) pixels[0] = black out.write(pixels) if __name__ == "__main__": password = "******" out.start() out.write(pixels) while True: M = imaplib.IMAP4_SSL("imap.gmail.com") try: rv, data = M.login(EMAIL_ACCOUNT, password) except imaplib.IMAP4.error: sys.exit(1) rv, mailboxes = M.list() rv, data = M.select(EMAIL_FOLDER) if rv == "OK": rv, data = M.search(None, "ALL") if rv != "OK": M.close() sys.exit(1) numcolors = 0 for num in data[0].split():