Arduino Function: RobotControl.playFile


Play an audio file stored on a SD card. The file type must be .sqm The funtions Robot.beginSpeaker() and Robot.beginSD() are required in setup() before using this method. Unlike Robot.playMelody() and Robot.playBeep(), playFile() does not halt other processes while playing. However, you cannot load new images on the LCD screen when playFile() is in use. Valid files for playback are generated/converted by the sound library Squawk. See the library README for details on how to create your own music.




filename: file name of the music to be played


#include <ArduinoRobot.h>

void setup(){
 Robot.beginSpeaker();//Initialize the sound module
 Robot.beginSD();//Initialize the sd card
 Robot.playFile("melody.sqm");//Play the original music come with the robot.

void loop(){
 //do other stuff here

Based on the reference originally written by Arduino Community, and