Skip to content

Search the documentation

Kit
Firmware

Buzzer

Smart Car

The robot’s buzzer: it plays songs in the background while your program goes on.

The Buzzer class is reached through this attribute of robot.

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.

The text of the song now playing, or None.

current_song: Optional[str]

Read only.

Used in examples: Song and lights

How loud songs play, in percent (0-100).

volume

Read only.

Used in examples: Song and lights

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) -> bool

You can leave out loop.

Used in examples: Find north, Song and lights, Name your robot, then drive it, Line follower

Stops the song.

stop()

Used in examples: Song and lights

Pauses the song; resume() goes on from there.

pause()

Used in examples: Song and lights

Goes on with a song that pause() stopped.

resume()

Used in examples: Song and lights

True while a song is playing.

is_playing() -> bool

Used in examples: Song and lights

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

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