Reference   Language | Libraries | Comparison | Changes

Robot

playFile()

Description

Play a .sqm music file stored on a SD card. Robot.beginSpeaker() and Robot.beginSD() are both required in setup().

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.

Syntax

Robot.playFile(filename)

Parameters

filename: file name of the music to be played

Returns

none

Examples

#include <ArduinoRobot.h>

void setup(){
  Robot.begin();
  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
}

See also

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.