Dfplayer mini with nano 33 iot

Hi, what is wrong with my code? when, i upload it to board it was successfully uploaded but not executing. Im sure that the pins connection are correct.

#include "DFRobotDFPlayerMini.h"
#include "Arduino.h"
#include "wiring_private.h"


Uart mySerial (&sercom1, 13, 8, SERCOM_RX_PAD_1, UART_TX_PAD_2);

// Attach the interrupt handler to the SERCOM
DFRobotDFPlayerMini myDFPlayer;



void setup() {
  // Reassign pins 13 and 8 to SERCOM (not alt this time)
  pinPeripheral(13, PIO_SERCOM);
  pinPeripheral(8, PIO_SERCOM);

  mySerial.begin(9600);
  Serial.begin(115200);

  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));

  if (!myDFPlayer.begin(mySerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true);
  }
  Serial.println(F("DFPlayer Mini online."));

  myDFPlayer.volume(30);  //Set volume value. From 0 to 30
  myDFPlayer.play(1);  //Play the first mp3
}

void loop() {
  // Do something with mySerial...
  
static unsigned long timer = millis();

  if (millis() - timer > 3000) {
    timer = millis();
    myDFPlayer.next();  //Play next mp3 every 3 second.
  }
}

void SERCOM1_Handler()
{
    mySerial.IrqHandler();
}

Is there no serial message coming from setup()?
If not, check the download report. Something went wrong...

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