Arduino

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
}
[Get Code]

#### See also

- beginSpeaker()
- beep()
- playMelody()

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.

### Share

### This link has expired.
Please re-subscribe to our Newsletters.

### Subscribe to our Newsletters

Email

Please enter a valid email to subscribe

Arduino Newsletter
Arduino Store Newsletter

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy

###### Newsletter

- ©2015 Arduino
- Copyright Notice
- Contact us
- About us
- Careers