Can we play an audio clip on mbot using play sound() or a recorded sound in scratch/mblock on a mbot?
The mBot itself does not have the capabilities to play any recorded sound. I’m being broad and defining that as anything in a sound file, ie WAV/OGG/MP3.
The only way to generate sound on the mBot is using the piezo/buzzer. There’s fun ways to try and stretch the capabilities of the buzzer, but nothing that comes close to the “simple” desire of playing a sound file.
When using the mBot in tethered mode, you can have sensors on the mBot cause mBlock/Scratch to play a sound file.
This means that the sound file is coming from the computer. If you want to build a device where the sound comes from the mBot unit, you could use a small Bluetooth speaker to bundle sound output into the robot.
Thanks Andrew for your prompt reply. What do you mean by tethered mode? So when you say bluetooth speaker, how do I pair it? Is there any document or example available anywhere that I could refer?
You’d pair the Bluetooth speaker to the computer you’re using, not to the robot. (mBot? Ranger?) I’m not sure if “tethered” is official makeblock terminology, but it’s what we use with students to describe programs written in mBlock running from a “When Green Flag clicked” block. These use an active serial connection (over Bluetooth, 2.4g Wireless Adapter or USB cable) to send commands to the robot and get data back.
In tethered mode, you can use sensors on the bot to trigger actions in mBlock. To play sounds, you’d use the purple/pink blocks from Sound palette. Something like this.
So this is a bit frustrating… Since MakeBlock doesn’t have the ability to play a MP3 file, I was going to use the code above to play sound via a bluetooth speaker… but the “play sound” function will not play on the makeblock app??? any ideas? I would like to have the robot appear as if it is playing the sounds! A speaker/mp3 module would be sweet… any ideas for an Arduino device I could add?