按照网上的教程学习播放sd卡的音乐 我想加一个按键控制 但是不行 请问一下 代码哪里不对 跪求
#include <SimpleSDAudio.h>
int inPin=7;
void setup()
{
pinMode(inPin,INPUT_PULLUP);
// If your SD card CS-Pin is not at Pin 4, enable and adapt the following line:
// SdPlay.setSDCSPin(10);
// Init SdPlay and set audio mode
if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO)) {
while(1); // Error while initialization of SD card -> stop.
}
// Select file to play
if(!SdPlay.setFile("GHSY.AFM")) {
while(digitalRead(inPin)==HIGH); // Error file not found -> stop.
}
// Start playback
SdPlay.play();
// Let the worker work until playback is finished
while(digitalRead(inPin)==HIGH) {
SdPlay.worker();
}
}