Last active
June 23, 2024 23:00
-
-
Save Shakil-Shahadat/6aae25736602c603f23f23a7e4454f41 to your computer and use it in GitHub Desktop.
✓ Play .wav files in Arduino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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