def __init__(self): print "SawsDisplay on serial", SawsConfig.SERIAL_PORT serialPorts = glob.glob(SawsConfig.SERIAL_PORT) try: port = serialPorts[0] self.bt = BlinkyTape(port) self.status = [999, 999, 999] len = id = idx = 0 for i in SawsConfig.LENGTHS: self.blocks.append(BlinkyBlock(idx, 1)) idx = idx + 1 self.blocks.append(BlinkyBlock(idx, SawsConfig.LENGTHS[id])) len = len + 1 + SawsConfig.LENGTHS[id] idx = idx + SawsConfig.LENGTHS[id] id = id + 1 self.blocks.append(BlinkyBlock(idx, 1)) len = len + 1 if len > SawsConfig.MAX_LEDS: raise Exception("Max LEDs is {}, you specified {}".format( SawsConfig.MAX_LEDS, len)) sys.exit(0) self.draw() except IndexError: print "Could not connect to Blinkytape on serial", SawsConfig.SERIAL_PORT sys.exit(0)
def __init__(self, port): self.t = None self.blinky = BlinkyTape(port) self.strip1 = Strip(self.blinky) self.min_tick = 0.01 self.max_tick = 0.1 self.multiplier = (self.max_tick - self.min_tick) / self.strip1.num_of_lights
def connect(): if config['usbport'] is not None: port = config['usbport'] blinky = BlinkyTape(port) blinky.displayColor(0, 0, 0) return blinky else: print "Make sure you have setup your config" exit()
class ModeManager(object): def __init__(self, *args, **kwargs): self.bb = BlinkyTape('/dev/ttyACM0') def render(self, colors): self.bb.send_list(colors) def run_mode(self, mode): while True: start = time.time() mode.calc_next_step() self.render(mode.get_colors()) if not mode.no_sleep: time.sleep(1.0/mode.fps) diff = time.time() - start sys.stdout.write("%.02f fps \r" % (1.0/diff))
class SawsDisplay: blocks = [] def __init__(self): print "SawsDisplay on serial", SawsConfig.SERIAL_PORT serialPorts = glob.glob(SawsConfig.SERIAL_PORT) try: port = serialPorts[0] self.bt = BlinkyTape(port) self.status = [999, 999, 999] len = id = idx = 0 for i in SawsConfig.LENGTHS: self.blocks.append(BlinkyBlock(idx, 1)) idx = idx+1 self.blocks.append(BlinkyBlock(idx, SawsConfig.LENGTHS[id])) len = len + 1 + SawsConfig.LENGTHS[id] idx = idx + SawsConfig.LENGTHS[id] id = id+1 self.blocks.append(BlinkyBlock(idx, 1)) len = len + 1 if len > SawsConfig.MAX_LEDS: raise Exception("Max LEDs is {}, you specified {}".format(SawsConfig.MAX_LEDS, len)) sys.exit(0) self.draw() except IndexError: print"Could not connect to Blinkytape on serial", SawsConfig.SERIAL_PORT sys.exit(0) def update(self, status): self.status = status def draw(self): t = Timer(SawsConfig.REDRAW_SPEED, self.draw) t.start() currentBlock = 0 for i in range(0, len(self.blocks)): if (i%2==0): self.blocks[i].draw(self.bt, 5) else: self.blocks[i].draw(self.bt, self.status[currentBlock]) currentBlock = currentBlock + 1 self.bt.sendUpdate()
class SawsDisplay: blocks = [] def __init__(self): print "SawsDisplay on serial", SawsConfig.SERIAL_PORT serialPorts = glob.glob(SawsConfig.SERIAL_PORT) try: port = serialPorts[0] self.bt = BlinkyTape(port) self.status = [999, 999, 999] len = id = idx = 0 for i in SawsConfig.LENGTHS: self.blocks.append(BlinkyBlock(idx, 1)) idx = idx + 1 self.blocks.append(BlinkyBlock(idx, SawsConfig.LENGTHS[id])) len = len + 1 + SawsConfig.LENGTHS[id] idx = idx + SawsConfig.LENGTHS[id] id = id + 1 self.blocks.append(BlinkyBlock(idx, 1)) len = len + 1 if len > SawsConfig.MAX_LEDS: raise Exception("Max LEDs is {}, you specified {}".format( SawsConfig.MAX_LEDS, len)) sys.exit(0) self.draw() except IndexError: print "Could not connect to Blinkytape on serial", SawsConfig.SERIAL_PORT sys.exit(0) def update(self, status): self.status = status def draw(self): t = Timer(SawsConfig.REDRAW_SPEED, self.draw) t.start() currentBlock = 0 for i in range(0, len(self.blocks)): if (i % 2 == 0): self.blocks[i].draw(self.bt, 5) else: self.blocks[i].draw(self.bt, self.status[currentBlock]) currentBlock = currentBlock + 1 self.bt.sendUpdate()
class ModeManager(object): def __init__(self, device='/dev/ttyACM0', *args, **kwargs): self.bb = BlinkyTape(device) def render(self, colors): self.bb.send_list(colors) def run_mode(self, mode): while True: start = time.time() mode.calc_next_step() self.render(mode.get_colors()) if not mode.no_sleep: renderTime = time.time() - start sleepTime = 1.0 / mode.fps - renderTime if sleepTime >= 0.0: time.sleep(sleepTime) diff = time.time() - start sys.stdout.write("%.02f fps \r" % (1.0 / diff))
def main(): """[Main function to run custom light program] """ logging.basicConfig(filename='lights.log', format='%(asctime)s %(message)s', level=logging.DEBUG) logging.getLogger().addHandler(logging.StreamHandler()) logging.debug('Begining to Run Program') usb_devices = find_usb_dev() bt = BlinkyTape(usb_devices) while True: driver(bt)
def display(): current_red_led_count=0 leds = getLedColourList(current_red_led_count) if not TEST: bb = BlinkyTape('/dev/ttyACM0') logging.info('Starting thread') while True: red_led_count = calculateRedLeds(statuses) # do stuff if (current_red_led_count != red_led_count): current_red_led_count = red_led_count logging.info('Change to number of red lights: %s', current_red_led_count) logging.debug('statuses: %s', statuses) leds = getLedColourList(current_red_led_count) else: animate(leds) if not TEST: bb.send_list(leds) time.sleep(0.1)
class FourHorsesVisualisation: def __init__(self, port): self.t = None self.blinky = BlinkyTape(port) self.strip1 = Strip(self.blinky) self.min_tick = 0.01 self.max_tick = 0.1 self.multiplier = (self.max_tick - self.min_tick) / self.strip1.num_of_lights def on_tweet(self, tweet): hashtags = [] for obj in tweet['entities']['hashtags']: hashtags.append(obj['text']) print hashtags if hashtags: m = self.match(hashtags) self.strip1.set_rgb(0, m) def start(self, time=0.05): self.t = Timer(time, self.tick) self.t.start() def tick(self): self.strip1.cycle() self.strip1.submit() self.blinky.show() self.start(self.max_tick - (self.multiplier * self.strip1.alive)) def match(self, strings): cleaned = [x.lower() for x in strings] for key, value in self.twitter_tags: if key.lower() in cleaned: return value['red'], value['green'], value['blue']
class FourHorsesVisualisation: def __init__(self, port): self.t = None self.blinky = BlinkyTape(port) self.strip1 = Strip(self.blinky) self.min_tick = 0.01 self.max_tick = 0.1 self.multiplier = (self.max_tick - self.min_tick) / self.strip1.num_of_lights def on_tweet(self, tweet): hashtags = [] for obj in tweet['entities']['hashtags']: hashtags.append(obj['text']) print hashtags if hashtags: m = self.match(hashtags) self.strip1.set_rgb(0, m) def start(self, time=0.05): self.t = Timer(time, self.tick) self.t.start() def tick(self): self.strip1.cycle() self.strip1.submit() self.blinky.show() self.start(self.max_tick - (self.multiplier*self.strip1.alive)) def match(self, strings): cleaned = [x.lower() for x in strings] for key, value in self.twitter_tags: if key.lower() in cleaned: return value['red'], value['green'], value['blue']
def __init__(self): print "SawsDisplay on serial", SawsConfig.SERIAL_PORT serialPorts = glob.glob(SawsConfig.SERIAL_PORT) try: port = serialPorts[0] self.bt = BlinkyTape(port) self.status = [999, 999, 999] len = id = idx = 0 for i in SawsConfig.LENGTHS: self.blocks.append(BlinkyBlock(idx, 1)) idx = idx+1 self.blocks.append(BlinkyBlock(idx, SawsConfig.LENGTHS[id])) len = len + 1 + SawsConfig.LENGTHS[id] idx = idx + SawsConfig.LENGTHS[id] id = id+1 self.blocks.append(BlinkyBlock(idx, 1)) len = len + 1 if len > SawsConfig.MAX_LEDS: raise Exception("Max LEDs is {}, you specified {}".format(SawsConfig.MAX_LEDS, len)) sys.exit(0) self.draw() except IndexError: print"Could not connect to Blinkytape on serial", SawsConfig.SERIAL_PORT sys.exit(0)
parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyACM0)", default="/dev/ttyACM0") (options, args) = parser.parse_args() if options.portname is not None: port = options.portname else: print "Usage: python wakeup.py -p <port name>" print "(ex.: python wakeup.py -p /dev/ttyACM0)" exit() sense = SenseHat() bt = BlinkyTape(port) # wake phase - gradually get brighter, linearly sleepTime = 18 # 18 sec for 30 min in 100 steps maxPower = 100 # flickers or cuts out above 100 for y in xrange(maxPower): sense.clear(y * 2, y * 2, y * 2) for x in xrange(sleepTime): bt.displayColor(y, y, y) sleep(1) # on phase - at full brightness for the same time sense.clear(255, 255, 255)
def send_binary(word, length, blinky, r, g, b): fmt = "{0:0" + str(length) + "b}" array = list(fmt.format(word)) for bit in array: blinky.sendPixel(r * int(bit), g * int(bit), b * int(bit)) parser = optparse.OptionParser() parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyUSB0)", default=None) options, args = parser.parse_args() if options.portname is not None: port = options.portname else: print "Usage: python binary_clock.py -p <port name>" print "(ex: python binary_clock.py -p /dev/ttypACM0)" exit() blinky = BlinkyTape(port) time.sleep(1 - datetime.now().microsecond / 1000000.0) # roughly synchronize with seconds while True: timeBegin = time.time() display(blinky) timeEnd = time.time() timeElapsed = timeEnd - timeBegin time.sleep(1 - timeElapsed)
""" Easily see your GPU temperature while gaming! This sets the LED colors base on your Nvidia GPU temperature, every second. 60F = green, 70F = yellow, 80F = red """ import time from BlinkyTape import BlinkyTape import subprocess import os import re ## To find your COM port number in Windows, run "Pattern Paint -> Help -> System Information" #bb = BlinkyTape('/dev/tty.usbmodemfa131') bb = BlinkyTape('COM3') while True: output = subprocess.check_output( ["C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe", "-a"], shell=True) #os.popen('C:\\Program Files\NVIDIA Corporation\NVSMI\nvidia-smi.exe') #output=os.popen("C:\\Program Files\\NVIDIA Corporation\\NVSMI\\nvidia-smi.exe").read() #print("====" + str(output) + "=====") temp = re.search("GPU Current.*", output).group()[30:33] temp_baseline = 60 temp_multiplier = 5 color_temp = (int(temp) - temp_baseline) * temp_multiplier green = 100 - color_temp red = 0 + color_temp blue = 0 print "Current GPU Temp: %s RGB: %s %s %s" % (temp, red, green, blue)
# initialize variables # saymtric = say metric measurement (in mm) else imperial (in inches) # last = last measurement read - used to determine movement # inches = used if conversion to imperial units desired # delta = value in mm to determine motion between readings # inrange = if closer then this, speak! (1800mm = 6' == 72") # mmmm[ ] = used to determine median of multiple readings -- filter out noise saymetric = False last = 0 inches = 0 delta = 2 #5#10 inrange = 1800 mmmm = [0, 0, 0] bb = BlinkyTape('/dev/ttyACM0', 60) red = (255, 0, 0) green = (0, 255, 0) yellow = (255, 255, 0) blue = (0, 0, 255) # Loop forever for constant measuring. Will speak if closer than 6 ft (180 cm) while True: # validate & convert text to numeric value in mm # filter noise by using median of 3 readings mmmm[0] = getDist() mmmm[1] = getDist() mmmm[2] = getDist()
"""Simple animation example using BlinkyTape.py""" from BlinkyTape import BlinkyTape from time import sleep import optparse parser = optparse.OptionParser() parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyUSB0)", default=None) (options, args) = parser.parse_args() if options.portname != None: port = options.portname else: print "Usage: python scanline.py -p <port name>" print "(ex.: python scanline.py -p /dev/ttypACM0)" exit() blinky = BlinkyTape(port) while True: for x in range(0, 60): for y in range(0, 60): l = max(((y-x)%60)-40,0) blinky.sendPixel(l*3,l*3,l*3) blinky.show() sleep(0.01)
search_radius = 75.0 # meters # Threshold to update target move state move_threshold = 15.0 # meters # GET URL for HSL url = "http://83.145.232.209:10001/?type=vehicles&lng1=" + str(bbox['llc'][0]) + "&lat1=" + str(bbox['llc'][1]) + "&lng2=" + str(bbox['urc'][0]) + "&lat2=" + str(bbox['urc'][1]) # BlinkyTape port #port = "/dev/ttyACM0" # RaspPi default port = "/dev/tty.usbmodem1411" # OSX # OTHER GLOBALS active_targets = [] # BlinkyTape bt = BlinkyTape(port) color_list = [] brightness_factor = 0.2 # 0 ... 1 # Show that we're alive for headless set-ups for i in xrange(0, 60): color_list.append((0,0,0)) bt.displayColor(i*3, i*3, i*3) time.sleep(0.1) def insideBBOX(tgt, bbox): if tgt[0] >= bbox['llc'][0] and tgt[0] < bbox['urc'][0] and tgt[1] >= bbox['llc'][1] and tgt[1] < bbox['urc'][1]: return True else: return False
from BlinkyTape import BlinkyTape import time bb = BlinkyTape('/dev/ttyACM0', 120) #bb = BlinkyTape('COM8') while True: for x in range(60): bb.sendPixel(100, 100, 100) bb.show() time.sleep(.5) for x in range(120): bb.sendPixel(0, 0, 0) bb.show() time.sleep(.5)
colours = { "bakerloo" : (137, 78, 36), "central" : (220, 36, 31), "circle" : (255, 206, 0), "district" : (0, 114, 41), "dlr" : (0, 175, 173), "hammersmith-city" : (215, 153, 175), "jubilee" : (106, 114, 120), "london-overground" : (232, 106, 16), "metropolitan" : (117, 16, 86), "northern" : (0, 0, 0), "piccadilly" : (0, 25, 168), "victoria" : (0, 160, 226), "waterloo-city" : (118, 208, 189), "tfl-rail" : (0, 25, 168) } bt = BlinkyTape(port) # Some visual indication that it works for headless setups (green tape) bt.displayColor(0, 100, 0) sleep(2) # Tape resets to stored pattern after a couple of seconds of inactivity while True: try: print "GET %s" % (url) rawHttpResponse = urllib.urlopen(url) lines = json.load(rawHttpResponse) if not len(lines) or lines is None: raise Exception("Error parsing data")
"central": (220, 36, 31), "circle": (255, 206, 0), "district": (0, 114, 41), "dlr": (0, 175, 173), "hammersmith-city": (215, 153, 175), "jubilee": (106, 114, 120), "london-overground": (232, 106, 16), "metropolitan": (117, 16, 86), "northern": (0, 0, 0), "piccadilly": (0, 25, 168), "victoria": (0, 160, 226), "waterloo-city": (118, 208, 189), "tfl-rail": (0, 25, 168) } bt = BlinkyTape(port) # Some visual indication that it works for headless setups (green tape) bt.displayColor(0, 100, 0) sleep(2) # Tape resets to stored pattern after a couple of seconds of inactivity while True: try: print "GET %s" % (url) rawHttpResponse = urllib.urlopen(url) lines = json.load(rawHttpResponse) if not len(lines) or lines is None: raise Exception("Error parsing data")
move_threshold = 15.0 # meters # GET URL for HSL url = "http://83.145.232.209:10001/?type=vehicles&lng1=" + str( bbox['llc'][0]) + "&lat1=" + str(bbox['llc'][1]) + "&lng2=" + str( bbox['urc'][0]) + "&lat2=" + str(bbox['urc'][1]) # BlinkyTape port #port = "/dev/ttyACM0" # RaspPi default port = "/dev/tty.usbmodem1411" # OSX # OTHER GLOBALS active_targets = [] # BlinkyTape bt = BlinkyTape(port) color_list = [] brightness_factor = 0.2 # 0 ... 1 # Show that we're alive for headless set-ups for i in xrange(0, 60): color_list.append((0, 0, 0)) bt.displayColor(i * 3, i * 3, i * 3) time.sleep(0.1) def insideBBOX(tgt, bbox): if tgt[0] >= bbox['llc'][0] and tgt[0] < bbox['urc'][0] and tgt[1] >= bbox[ 'llc'][1] and tgt[1] < bbox['urc'][1]: return True else:
def __init__(self, device='/dev/ttyACM0', *args, **kwargs): self.bb = BlinkyTape(device)
parser.add_option("-s", "--size", dest="size", help="Size of the light wave", default=60, type=int) (options, args) = parser.parse_args() if options.portname is not None: port = options.portname else: print("Usage: python scanline.py -p <port name>") print("(ex.: python scanline.py -p /dev/ttypACM0)") exit() blinky = BlinkyTape(port, options.ledcount) while True: for position in range(options.ledcount): print(position) for led in range(options.ledcount): if position < led: blinky.sendPixel(0, 0, 0) else: print(led) print(f[led]) blinky.sendPixel(*f[led]) blinky.show() if position < dead or position > (options.ledcount - dead): pass
import time import metoffer from BlinkyTape import BlinkyTape from datetime import datetime bb = BlinkyTape('/dev/ttyACM0') RGB_OFFSET = 25 def getTemperatures(): print "getTemperatures start" api_key = '35d53d57-9aa0-45de-9772-0871f0ceffda' M = metoffer.MetOffer(api_key) x = M.nearest_loc_forecast(52.2793,-1.5803, metoffer.THREE_HOURLY) y = metoffer.parse_val(x) print "data retrieved" for i in y.data: print("{} - {}".format(i["timestamp"][0].strftime("%d %b, %H:%M"), i["Temperature"][0])) print "getTemperatures end" return y.data def increasingColourOffset(offset): return offset * RGB_OFFSET def decreasingColourOffset(offset): return 255 - increasingColourOffset(offset) #20 10 0 10 20 30 40 def convertTemperatureToRgb(temperature): if (temperature <= -15):
# Default Blinky Tape port on Raspberry Pi is /dev/ttyACM0 parser = optparse.OptionParser() parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyACM0)", default="/dev/ttyACM0") (options, args) = parser.parse_args() if options.portname is not None: port = options.portname else: print "Usage: python Huxley_UK_Rail_Station_Delays.py -p <port name>" print "(ex.: python Huxley_UK_Rail_Station_Delays.py -p /dev/ttyACM0)" exit() url = "https://huxley.apphb.com/delays/{}/to/{}/50/{}?accessToken={}".format(crs, filterCrs, trainTime, accessToken) bt = BlinkyTape(port) # Some visual indication that it works for headless setups (green tape) bt.displayColor(0, 100, 0) sleep(2) # Tape resets to stored pattern after a couple of seconds of inactivity while True: try: print "GET %s" % (url) rawHttpResponse = urllib.urlopen(url) stationStatus = json.load(rawHttpResponse) if not len(stationStatus) or stationStatus is None: raise Exception("Error parsing data")
from BlinkyTape import BlinkyTape import urllib2 import re from time import sleep import random import math bb = BlinkyTape('/dev/ttyACM0') #least on Mac OS X, this is the port to use! OFF_COLOUR = [0,0,0] DISPLAY_COLOUR = [254,0,0] R_INTERVAL = DISPLAY_COLOUR[0]/15 G_INTERVAL = DISPLAY_COLOUR[1]/15 B_INTERVAL = DISPLAY_COLOUR[2]/15 DISPLAY_LENGTH = 60 UPDATE_INTERVAL = 0.02 pixels=[OFF_COLOUR for i in range(DISPLAY_LENGTH)] def fadePixel(pixel): if pixel[0] != 0: pixel[0] = pixel[0] - R_INTERVAL if pixel[0] < 0: pixel[0] = 0 if pixel[1] != 0: pixel[1] = pixel[1] - G_INTERVAL if pixel[1] < 0: pixel[1] = 0 if pixel[2] != 0: pixel[2] = pixel[2] - B_INTERVAL
import optparse # Default Blinky Tape port on Raspberry Pi is /dev/ttyACM0 parser = optparse.OptionParser() parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyACM0)", default="/dev/ttyACM0") (options, args) = parser.parse_args() if options.portname is not None: port = options.portname else: print "Usage: python wakeup.py -p <port name>" print "(ex.: python wakeup.py -p /dev/ttyACM0)" exit() sense = SenseHat() bt = BlinkyTape(port) # wake phase - gradually get brighter, linearly sleepTime = 18 # 18 sec for 30 min in 100 steps maxPower = 100 # flickers or cuts out above 100 for y in xrange(maxPower): sense.clear(y * 2, y * 2, y * 2) for x in xrange(sleepTime): bt.displayColor(y, y, y) sleep(1) # on phase - at full brightness for the same time
def __init__(self, *args, **kwargs): self.bb = BlinkyTape('/dev/ttyACM0')
from time import sleep import optparse parser = optparse.OptionParser() parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyUSB0)", default=None) parser.add_option("-c", "--count", dest="ledcount", help="LED count", default=60, type=int) parser.add_option("-s", "--size", dest="size", help="Size of the light wave", default=20, type=int) (options, args) = parser.parse_args() if options.portname is not None: port = options.portname else: print("Usage: python scanline.py -p <port name>") print("(ex.: python scanline.py -p /dev/ttypACM0)") exit() blinky = BlinkyTape(port, options.ledcount) while True: for position in range(-options.size, options.ledcount + options.size): for led in range(options.ledcount): if abs(position - led) < options.size: blinky.sendPixel(255,0,200) else: blinky.sendPixel(0,0,0) blinky.show() sleep(0.005)
parser = optparse.OptionParser() parser.add_option("-p", "--port", dest="portname", help="serial port (ex: /dev/ttyACM0)", default="/dev/ttyACM0") (options, args) = parser.parse_args() if options.portname is not None: port = options.portname else: print "Usage: python Aurora.py -p <port name>" print "(ex.: python Aurora.py -p /dev/ttyACM0)" exit() # Documentation: http://aurorawatch.lancs.ac.uk/api_info/ # Code and spec: https://github.com/stevemarple/AuroraWatchNet url = 'http://aurorawatch.lancs.ac.uk/api/0.1/status.xml' bt = BlinkyTape(port) request = urllib2.Request(url) request.add_header('User-Agent', 'BlinkyTape Aurora Alert unop.uk') opener = urllib2.build_opener() # Some visual indication that it works, for headless setups (green tape) bt.displayColor(0, 100, 0) sleep(2) while True: try: print "GET %s" % (url) rawXml = opener.open(request).read() tree = ElementTree.fromstring(rawXml)
from BlinkyTape import BlinkyTape bb = BlinkyTape("/dev/tty.usbmodemfa131") while True: for x in range(0, 60): bb.sendPixel(10, 10, 10) bb.show() for x in range(0, 60): bb.sendPixel(0, 0, 0) bb.show()
from BlinkyTape import BlinkyTape import time from random import randint bb = BlinkyTape() led_count = 60 rgb_max = 100 pixel_half_on = [rgb_max, rgb_max, rgb_max] pixel_off = [0, 0, 0] def shuttle_extend(n=1,step=2): for i in range(n): bb.clear_all() for s in range(0,led_count,step): pixel_random_on = [randint(0,rgb_max), randint(0,rgb_max), randint(0,rgb_max)] for t in range(s+1): pixel_list = map(lambda x: pixel_random_on if x<=t else pixel_off, range(led_count)) bb.send_list(pixel_list) for t in range(s, -1, -1): pixel_list = map(lambda x: pixel_random_on if x<=t else pixel_off, range(led_count)) bb.send_list(pixel_list) bb.clear_all() def kitt_eye_pixel(x,w,s): # kitt's eye is w pixels wide and starts at position s return pixel_half_on if (x>=s and x<(s+w)) else pixel_off def kitt_eye(w=5): # kitt's eye is w pixels wide bb.clear_all() for s in range(led_count-w): pixel_list = map(lambda x: kitt_eye_pixel(x,w,s), range(led_count))