예제 #1
0
import time

print 'hello from python, i just synced at ' + str(time.time())

from Led_Array import Led_Array, Color

if __name__ == '__main__':
    # Create NeoPixel object with appropriate configuration.
    led_array = Led_Array()

    while True:
        color = Color(0, 60, 0)
        led_array.fill_up_to(7, color)
        time.sleep(5)
        led_array.empty_array()
        time.sleep(3)
예제 #2
0
import os
import datetime as dt
import time
import requests
from pydash import py_
from colour import Color
import json

import time, signal, sys, datetime
from time import sleep
from Led_Array import Led_Array

led_array = Led_Array()

HEADERS = {'Authorization': 'Bearer ' + os.environ['FRONT_TOKEN']}
INBOX_IDS = os.getenv('INBOX_IDS', 'inb_n62,inb_nla').split(',')
COLORS = os.getenv('COLORS', '#3aff5b,#f44242').split(',')
colorStart = Color(COLORS[0])
colorEnd = Color(COLORS[1])
COLOR_SCALE = list(colorStart.range_to(colorEnd, 60))
INTERVAL = int(os.getenv('INTERVAL', '5'))

print 'Available ENV vars:'
print '  FRONT_TOKEN'
print '  INBOX_IDS'
print '  COLORS'
print '  INTERVAL'


def getConvos(inboxId, pageIndex):
    resultArr = list()
예제 #3
0
    return output_min + (value_scaled * output_span)

current_max = -100000
# for i in range(0, int(RATE / CHUNK * 5)):
#     data_chunk = stream.read(CHUNK)
#     rms = audioop.rms(data_chunk, 2)
#     if rms > current_max:
#         current_max = rms
#     level = convert_scale(rms, 0, AUDIO_MAX, 0, MAX_ROWS)
#     max_level = convert_scale(current_max, 0, AUDIO_MAX, 0, MAX_ROWS)
#     print 'level: ', level, 'current max: ', max_level

if __name__ == '__main__':
    # Create NeoPixel object with appropriate configuration.
    led_array = Led_Array()

    while True:
        try:
            data_chunk = stream.read(CHUNK)
        except IOError as e:
            print "I/O error({0}): {1}".format(e.errno, e.strerror)
            continue

        rms = audioop.rms(data_chunk, 2)
        if rms > current_max:
            current_max = rms
        level = convert_scale(rms, 0, AUDIO_MAX, 0, MAX_ROWS)
        max_level = convert_scale(current_max, 0, AUDIO_MAX, 0, MAX_ROWS)
        print 'level: ', level, 'current max: ', max_level
예제 #4
0
import time
print 'hello from python, i just synced at '+ str(time.time())

from Led_Array import Led_Array, Color

if __name__ == '__main__':
    # Create NeoPixel object with appropriate configuration.
    led_array = Led_Array()

    while True:
        color = Color(0, 60, 0)
        led_array.fill_up_to(7,color)
        time.sleep(5)
        led_array.empty_array()
        time.sleep(3)