DFPlayer Mini Not Connecting To Beetle CM-32U4

Sorry if this is the wrong place to ask this, not really sure where they go for help.

I am working on our project where with a button is pressed and held, track 2 plays, and when release track 1 immediately plays. Code is posted below.

When using an Arduino Uno with pins 10 and 11 as the Rx and Tx pins, everything works great. When using the Beetle CM-32U4 with pins 0 and 1, it cannot connect to the DFPlayer Mini. I tried the same with a Pro Micro and changed the Pins with no luck as well.

I have the DFPlayer setup on a bread board so my setup stays the same when switching between various micro controllers. I am powering the DFPlayer via the micro controllers and have tried powering it separately with no luck.

I am at a loss on what to try next to get this working on the Beetle CM-32U4 and not just the Uno.

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>

// Define pins for the button and the software serial connection to DFPlayer Mini
#define BUTTON_PIN 2
SoftwareSerial mySoftwareSerial(0, 1); // RX, TX pins for communication with DFPlayer
DFRobotDFPlayerMini myDFPlayer;

bool lastButtonState = LOW; // Previous button state
bool currentButtonState = LOW; // Current button state
int songOnPress = 2; // Song number to play on button press (SD card file number)
int songOnRelease = 1; // Song number to play on button release (SD card file number)

void setup() {
  // Initialize serial communication for debugging
  Serial.begin(9600);
  
  // Initialize button pin
  pinMode(BUTTON_PIN, INPUT_PULLUP);

  // Initialize software serial for DFPlayer communication
  mySoftwareSerial.begin(9600);

  // Initialize DFPlayer Mini
  if (!myDFPlayer.begin(mySoftwareSerial)) {
    Serial.println("DFPlayer Mini not detected!");
    while (true); // Stay here if DFPlayer isn't detected
  }

  // Set volume (0-30)
  myDFPlayer.volume(25); 
  Serial.println("DFPlayer Mini ready.");
}

void loop() {
  // Read the button state
  currentButtonState = digitalRead(BUTTON_PIN);

  // Check if the button state has changed (pressed or released)
  if (currentButtonState != lastButtonState) {
    if (currentButtonState == LOW) {
      // Button pressed
      Serial.println("Button Pressed");
      myDFPlayer.play(songOnPress);// Play song on button press
    } else {
      // Button released
      Serial.println("Button Released");
      myDFPlayer.play(songOnRelease); // Play song on button release
    }
    
    // Update the last button state
    lastButtonState = currentButtonState;
    
    // Add a small delay to debounce the button press
    delay(50);
  }
}

Why would you declare a SoftwareSerial object on pins 0 and 1 when there's a perfectly good hardware Serial1 object already available on those pins?

I just tried using the hardware Serial1 to play track 2, and all I get is a "click" sound from the speaker and a message from the serial monitor that the dfplayer is not connected.

#include <DFRobotDFPlayerMini.h>

// Use Serial1 for communication with DFPlayer Mini
DFRobotDFPlayerMini myDFPlayer;

void setup() {
  // Initialize hardware serial communication
  Serial1.begin(9600);  // Set baud rate for communication with DFPlayer Mini
  Serial.begin(9600);   // For monitoring through Serial Monitor

  // Initialize DFPlayer Mini
  if (!myDFPlayer.begin(Serial1)) {
    Serial.println("DFPlayer Mini not detected.");
    while(true);  // Halt if DFPlayer Mini is not detected
  }

  Serial.println("DFPlayer Mini Online.");

  // Start playing track 2
  myDFPlayer.play(2);  // Play track 2 from the microSD card
}

void loop() {
  // Here you can check status or control the player further if needed
  if (myDFPlayer.available()) {
    int song = myDFPlayer.readType();  // Read the player status
    if (song == DFPlayerPlayFinished) {
      Serial.println("Track finished playing");
    }
  }
}
#include <DFRobotDFPlayerMini.h>

// Use Serial1 for communication with DFPlayer Mini
DFRobotDFPlayerMini myDFPlayer;

void setup() {
  // Initialize hardware serial communication
  Serial1.begin(9600);  // Set baud rate for communication with DFPlayer Mini
  Serial.begin(9600);   // For monitoring through Serial Monitor
  delay(2500);
  myDFPlayer.begin(Serial1, true);

  // Initialize DFPlayer Mini
  if (!myDFPlayer.begin(Serial1)) {
    Serial.println("DFPlayer Mini not detected.");
    while(true);  // Halt if DFPlayer Mini is not detected
  }

  Serial.println("DFPlayer Online.");

  // Start playing track 2
  myDFPlayer.play(2);  // Play track 2 from the microSD
  delay(3000);  // give track2 time to play. And does it??
}

void loop() 
{
}

That worked, I think. I get some clicks from the speaker and the serial monitor says the player is online. Tried using an outside power source and a capacitor, but it did not change things.

dont know what I did, but it is all working now, thank you.