Error when verifying my code

Hi I have to make a code for a school project but I don't know how to make it work.
Can anyone help, what am I doing wrong? :)))

This is the code:

#include "WT2003S_Player.h"
#include <SoftwareSerial.h>
SoftwareSerial SSerial(2, 3); // RX, TX
#define COMSerial SSerial
WT2003S<SoftwareSerial> Mp3Player;
const int BUTTONPIN = 6;
int buttonState = 0;
boolean playing = false;

void setup() {
    pinMode(BUTTONPIN, INPUT);

void loop() {
  buttonState = digitalRead(BUTTONPIN);  
  if (buttonState == 1) {
    Mp3Player.playSDSong(const char* Playboi Carti - Not Playing (Official Audio))();

C:\Users\User\Downloads\mp3_player\mp3_player.ino: In function 'void loop()':

mp3_player:27:26: error: expected primary-expression before 'const'

 Mp3Player.playSDSong(const char* Playboi Carti - Not Playing (Official Audio))();


exit status 1

expected primary-expression before 'const'

First step: present your code properly formatted and enclosed in Code Tags </>. See the sticky topics on top of the forum.

Next step: show the error messages as text.

It goes much quicker if you tell us what the error is.

Please remember to use code tags when posting code.

There's no good reason to give buttonState global scope

I'm sorry first time using this forum.
I think I did it right rn

1 Like

This should be a filename in quotes. Looks like a copy/paste problem ? :wink:

Something like


You need to specify the file name to be played as a string, I guess:

Mp3Player.playSDSong("Playboi Carti - Not Playing (Official Audio).mp3");

Maybe it does, but your switch is wired to another pin.

Who knows?

Check the sequence of #define statments. I believe they should come before any code.

This define should not be there at all: #define COMSerial SSerial

Pullup should also be used for the button, it should be properly debounced and there should be state change detection implemented.

fixed it, thank you all!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.