def test_05_play_rtttl(self):
     buzz = BuzzerPlayer()
     if hasattr(buzz, 'play_rtttl'):
         buzz.play_rtttl(songs.find('Entertainer'))
示例#2
0
            rgb.off()
            return

        sofar.append(freq)
        val = (freq - min(sofar)) / max(sofar) * 100
        logger.debug(str(val))
        m = random.randint(1, 3)
        if m == 1:
            rgb.red(val)
            rgb.blue(0)
            rgb.green(0)
        if m == 2:
            rgb.blue(val)
            rgb.red(0)
            rgb.green(0)
        if m == 3:
            rgb.green(val)
            rgb.red(0)
            rgb.blue(0)

    buzz = BuzzerPlayer(callback=blink_led)

    try:
        while True:
            for song_name, v in songs.items():
                tempo, song = v
                buzz.play_nokia_tone(tempo=tempo, song=song, name=song_name)
    finally:
        buzz.channel.pulse_width_percent(0)
        rgb.off()
 def test_03_play_nokie_tone_file(self):
     buzz = BuzzerPlayer(1, 2, 4)
     buzz.play_nokia_tone(buzz.from_file(self.nokia_file), name='star_wars')
 def test_04_play_midi(self):
     buzz = BuzzerPlayer()
     if hasattr(buzz, 'play_midi'):
         buzz.play_midi(self.sample_file, track=1)
 def test_03_play_nokia_tone_pyborad(self):
     buzz = BuzzerPlayer(1, 2, 4, platform='pyboard')
     song = nokia_songs['pink_panther']
     buzz.play_nokia_tone(song, name='pink_panther')
 def test_03_play_nokia_tone_esp8266(self):
     buzz = BuzzerPlayer(12, platform="esp8266")
     song = nokia_songs['pink_panther']
     buzz.play_nokia_tone(song, name='pink_panther')
 def test_03_play_nokia_tone(self):
     buzz = BuzzerPlayer(1, 2, 4)
     song = nokia_songs['pink_panther']
     buzz.play_nokia_tone(song, name='pink_panther')
 def test_02_init(self):
     b = BuzzerPlayer(1, 2, 4)
 def test_01_init_no_params(self):
     b = BuzzerPlayer()