方法sprintf()在Arduino上无效。我还能如何将字符串转换为char *?

 if(triggerNumber == 4)
 { currenttrack = 5;
 }
  sprintf(trackName, "track%03d.mp3", currenttrack);

  playMP3(trackName); //Go play XX.mp3

最佳答案

我相信,如果您包含stdio.h,snprintf将会起作用

snprintf(trackName, sizeof(trackName), "track%03d.mp3", currenttrack);

07-28 02:58