SunFounder PiCrawler Kit
Functions related to background music include these:
• music = Music() : Declare the object.
• music.music_set_volume(20) : Set the volume, the range is 0~100.
• music.background_music(./musics/sports-Ahjay_Stelino.mp3) : Play music files, here is
the sports-Ahjay_Stelino.mp3 file under the ./musics path.
• music.music_stop() : Stop playing background music.
Note: You can add different sound effects or music to musics or sounds folder via Filezilla Software.
Functions related to sound effects include these:
• music = Music()
• music.sound_effect_play('./sounds/talk1.wav') : Play the sound effect file, here is the
talk1.wav file under the ./musics path.
• muisc.sound_effect_threading('./sounds/talk1.wav') : Play the sound effect file in a new
thread mode without suspending the main thread.
Functions related to Text to Speech include these:
• tts = TTS()
• tts.say(words) : Text audio.
• tts.lang("en-US") : Set the language.
Note: Set the language by setting the parameters of lang("") with the following characters.
Table 1: Language
zh-CN Mandarin (Chinese)
en-US English-United States
en-GB English-United Kingdom
de-DE Germany-Deutsch
es-ES España-Español
fr-FR France-Le français
it-IT Italia-lingua italiana
3.6 Obstacle Avoidance
In this project, picrawler will use an ultrasonic module to detect obstacles in front. When PiCrawler detects an obstacle,
it will send a signal and look for another direction to move forward.
3.6. Obstacle Avoidance 53