Skip to content

Instantly share code, notes, and snippets.

@Shakil-Shahadat
Last active June 23, 2024 23:00
Show Gist options
  • Save Shakil-Shahadat/6aae25736602c603f23f23a7e4454f41 to your computer and use it in GitHub Desktop.
Save Shakil-Shahadat/6aae25736602c603f23f23a7e4454f41 to your computer and use it in GitHub Desktop.
✓ Play .wav files in Arduino
#include "SD.h"
#include "SPI.h"
#include "TMRpcm.h"
#define SD_ChipSelectPin 10
TMRpcm tmrpcm;
void setup()
{
tmrpcm.speakerPin = 9;
if ( !SD.begin( SD_ChipSelectPin ) )
{
Serial.println( "SD fail" );
return;
}
tmrpcm.setVolume( 5 );
tmrpcm.quality( 1 );
tmrpcm.play( "1.wav" );
}
void loop()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment