Buzzer
Smart CarThe robot’s buzzer: it plays songs in the background while your program goes on.
How you reach it
Section titled “How you reach it”The Buzzer class is reached through this attribute of robot.
robot.buzzer
Section titled “robot.buzzer”Can be None.
All the attributes of robot are in its table. Read Attributes that can be None to see when a part is None.
Properties
Section titled “Properties”current_song
Section titled “current_song”The text of the song now playing, or None.
current_song: Optional[str]Read only.
Used in examples: Song and lights
volume
Section titled “volume”How loud songs play, in percent (0-100).
volumeRead only.
Used in examples: Song and lights
Methods
Section titled “Methods”play_song(song, loop)
Section titled “play_song(song, loop)”Starts playing a song from SONGS (or your own song text) and returns at once; loop=True repeats it until stop().
play_song(song, loop: bool) -> boolYou can leave out loop.
Used in examples: Find north, Song and lights, Name your robot, then drive it, Line follower
stop()
Section titled “stop()”Stops the song.
stop()Used in examples: Song and lights
pause()
Section titled “pause()”Pauses the song; resume() goes on from there.
pause()Used in examples: Song and lights
resume()
Section titled “resume()”Goes on with a song that pause() stopped.
resume()Used in examples: Song and lights
is_playing()
Section titled “is_playing()”True while a song is playing.
is_playing() -> boolUsed in examples: Song and lights
set_tempo(tempo)
Section titled “set_tempo(tempo)”Sets how slowly songs play: one beat lasts tempo x max(50, 10 x tempo) ms (3, the default, is 150 ms); higher is slower.
set_tempo(tempo)Used in examples: Song and lights
set_volume(percent)
Section titled “set_volume(percent)”Sets how loud songs play, from 0 (silent) to 100 percent (the loudest); the default is about 8.
set_volume(percent)Used in examples: Song and lights