Skip to content

Instantly share code, notes, and snippets.

@unknowndomain
Last active May 2, 2017 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unknowndomain/32d1a6d883d4cecb8716597ce859c0bc to your computer and use it in GitHub Desktop.
Save unknowndomain/32d1a6d883d4cecb8716597ce859c0bc to your computer and use it in GitHub Desktop.
This is a basic example of playing five short MP3s in a loop.
void setup() {
// Start the serial port at 38.4K
Serial.begin( 38400 );
// Set volume
Serial.print( "v" );
Serial.write( 0 ); // 0 = maximum volume, 255 = minimum volume
}
void loop() {
// Loop from 1 to 5
for ( int i = 1; i <= 5; i++ ) {
// Play file i ( 1 to 5 )
Serial.print( "p" );
Serial.write( i );
// Wait a bit
delay( 1000 );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment