EV3 MicroPython comes with pre-recorded sound files. Here's how to program your robot to play them.
- 04 Jun 2020
To play a sound file, you have to use the "ev3.speaker.play_file()" command and set the file you wish to play as an input parameter.
The sound file is called using the "SoundFile" class followed by the name of the sound file.
This command will play the "OKAY" sound file. If we wish to play the "BRAVO", we should change the code to the following:
A full list of the sound files you can use with this class can be found in the "media" section of the PYBRICKS documentation.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons