Ejemplo n.º 1
0
#     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

        color = Color(0, 60, 0)
        led_array.fill_up_to(int(level),color)
        sleep(0.1)

clean_up()
Ejemplo n.º 2
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)
Ejemplo n.º 3
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)