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() {
    COMSerial.begin(9600);
    Mp3Player.init(COMSerial);
    pinMode(BUTTONPIN, INPUT);
}

void loop() {
  if(playing==false){
    Mp3Player.playSDRootSong(6);
    Mp3Player.volume(20);
    playing=true;
  }
  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

Mp3Player.playSDSong("songfile.mp3");

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!