示例#1
0
def shutdown():
    config.proc_Popen.kill()
    os.system("mpc stop")
    clear()
    config.segment.clear()
    config.segment.write_display()
    check_call(['sudo', 'poweroff'])
示例#2
0
def test_vumeter():
    speed = 20

    for i in range(1000):
        offset = int((math.sin(time.time() * speed) * 5) + 5)

        speakerphat.clear()
        speakerphat.set_led(offset, 255)
        speakerphat.show()
示例#3
0
def retune():
    config.station += 1
    # Assumes there are 7 stations
    if config.station > 7:
        config.station = 1
    os.system("mpc play " + str(config.station))
    # updates the Speaker pHat LEDs to show the station
    clear()
    for x in range(config.station):
        set_led(x, 180)
    show()
    # stops the clock subprocess and shows the station on the 7 seg
    config.proc_Popen.kill()
    config.segment.clear()
    config.segment.write_display()
    config.segment.set_digit(3, config.station)
    config.segment.write_display()
    time.sleep(4.0)
    config.segment.clear()
    config.segment.write_display()
    config.proc_Popen  # This is the bit that's got me baffled.
示例#4
0
#!/usr/bin/env python

import math
import time
import sys

sys.path.append('../python/')

import speakerphat

speed = 4

for i in range(1000):
    offset = int((math.sin(time.time() * speed) * 5) + 5)

    speakerphat.clear()
    speakerphat.set_led(offset, 255)
    speakerphat.show()
示例#5
0
文件: sound.py 项目: kghite/mahri
 def start_mp3(self, filepath):
     os.system('omxplayer -o local %s &', filepath)
     speakerphat.clear()
     for x in range(10):
         speakerphat.set_led(x, 255 / (x + 1))
     speakerphat.show()
示例#6
0
        set_led(x, 180)
    show()
    # stops the clock subprocess and shows the station on the 7 seg
    config.proc_Popen.kill()
    config.segment.clear()
    config.segment.write_display()
    config.segment.set_digit(3, config.station)
    config.segment.write_display()
    time.sleep(4.0)
    config.segment.clear()
    config.segment.write_display()
    config.proc_Popen  # This is the bit that's got me baffled.


shutdown_btn = Button(17, hold_time=3)
shutdown_btn.when_held = shutdown

retune_btn = Button(23)
retune_btn.when_pressed = retune

# starts clock.py
config.proc_Popen

# sets the Speaker pHat LEDS to indicate the station
clear()
for x in range(config.station):
    set_led(x, 128)
show()
os.system("mpc play " + str(config.station))
pause()