示例#1
0
                  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)
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(60):
        bb.sendPixel(0, 0, 0)
    bb.show()

    time.sleep(.5)
示例#3
0
while True:

    output = str(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 = 55  # configure to you base line temp here
    temp_multiplier = 5
    color_temp = (int(temp) - temp_baseline) * temp_multiplier
    green = min(254, max(0, 100 - color_temp))
    red = min(254, max(0, 0 + color_temp))
    blue = 0
    print("Current GPU Temp: %s   RGB: %s %s %s" % (temp, red, green, blue))

    for x in range(60):
        bb.sendPixel(red, green, blue)
    bb.show()

    # time.sleep(1)

    # for x in range(60):
    #    bb.sendPixel(100, 0, 0)
    # bb.show()

    time.sleep(1)
示例#4
0
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)
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")

        # Sort the lines
        lines.sort(key = lambda l: l['modeName'], reverse = True)

        # Takes at least 2 min
        for cycles in xrange(240):
            for pixel in xrange(2):
                bt.sendPixel(0, 0, 0)
            for line in lines:
                alert = False
                for status in line['lineStatuses']:
                    # https://api.tfl.gov.uk/line/meta/severity
                    if status['statusSeverity'] != 10:
                        alert = True
                r, g, b = colours[line['id']]
                for pixel in xrange(4):
                    if alert:
                        # Flash for delays
                        l = (cycles - pixel) % 2
                        if line['id'] == "northern":
                            # Because black on black doesn't show up
                            r, g, b = 100, 100, 100
                        bt.sendPixel(l * r, l * g, l * b)
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)
示例#7
0
        print("Lon index: " + str(longitude_index))
        print("Next latitude: " + str(loc[0]))

        # grab the applicable pixel indices
        indices = [(int)(x * (cols / n_leds)) for x in range(n_leds)]

        # sample that row of pixel data
        output_pixels = np.take(a[latitude_index], indices, axis=0)

        # rotate the row to center around the specified longitude
        output_pixels = np.roll(output_pixels, longitude_index, axis=0)

        # send all pixel data to bt
        for pixel in output_pixels:
            print("Sending r: {}, g: {}, b: {}".format(*pixel))
            bt.sendPixel(*pixel)

        # finally, show the image
        bt.show()

        # delete variables for memory management
        del a
        del im

        # Tape resets to stored pattern after a few seconds of inactivity
        sleep(rate * 60)  # Wait specified number of minutes
        # sleep(10)  # Wait specified number of minutes

    except KeyboardInterrupt:
        print("Keyboard interrupt, ending program.")
        sys.exit()
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)
    
    for x in range(60):
        bb.sendPixel(red, green, blue)
    bb.show()
    
    #time.sleep(1)
    
    #for x in range(60):
    #    bb.sendPixel(100, 0, 0)
    #bb.show()

    time.sleep(1)

    
示例#9
0
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")

        # Sort the lines
        lines.sort(key=lambda l: l['modeName'], reverse=True)

        # Takes at least 2 min
        for cycles in xrange(240):
            for pixel in xrange(2):
                bt.sendPixel(0, 0, 0)
            for line in lines:
                alert = False
                for status in line['lineStatuses']:
                    # https://api.tfl.gov.uk/line/meta/severity
                    if status['statusSeverity'] != 10:
                        alert = True
                r, g, b = colours[line['id']]
                for pixel in xrange(4):
                    if alert:
                        # Flash for delays
                        l = (cycles - pixel) % 2
                        if line['id'] == "northern":
                            # Because black on black doesn't show up
                            r, g, b = 100, 100, 100
                        bt.sendPixel(l * r, l * g, l * b)