Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15265

ESP32 + DY SV8F (MP3 player)

$
0
0

hello,
i have connected it on serial2 (16,17) rx->tx and tx->rx.
i can't get it to play a specific mp3.
all mp3 are in root named 00001.mp3 00002.mp3 etc.

is there something wrong with my code?
(i try 2 ways to get it to play the files .. both fail)

#include <Arduino.h>
#include "DYPlayerArduino.h"

// Initialise the player, it defaults to using Serial.
//DY::Player player;

// Alternatively initialise on another serial port.
DY::Player player(&Serial2);

void setup() {
  Serial.begin(115200);
  Serial2.begin(9600);


  player.begin();
  player.setVolume(15);  // 50% Volume
                         //  player.setCycleMode(DY::PlayMode::Random); // Play all randomly and repeat.
  player.setCycleMode(DY::PlayMode::OneOff);

  player.play();
}

void loop() {
  Serial.println(" 0x01   playing 1");
  player.playSpecified(0x01);
  delay(3000);
  Serial.println("    playing 1");
  player.playSpecified(1);
  delay(3000);


  Serial.println(" 0x02   playing 2");
  player.playSpecified(0x02);
  delay(3000);
  Serial.println("    playing 2");
  player.playSpecified(2);
  delay(3000);

  Serial.println(" 0x03   playing 3");
  player.playSpecified(0x03);
  delay(3000);
  Serial.println("    playing 3");
  player.playSpecified(3);
  delay(3000);

  Serial.println(" 0x04   playing 4");
  player.playSpecified(0x04);
  delay(3000);
  Serial.println("    playing 4");
  player.playSpecified(4);
  delay(3000);

  Serial.println(" 0x05   playing 5");
  player.playSpecified(0x05);
  delay(3000);
  Serial.println("    playing 5");
  player.playSpecified(5);
  delay(3000);

}

10 posts - 3 participants

Read full topic


Viewing all articles
Browse latest Browse all 15265

Trending Articles