>> INICIO     

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

  /*  Cap-18 MODULO DFPlayer Mini - Reproductor mp3  */  

 

 

 

  CLASE 

 

 

 

  COMANDOS  

 

GLOBALES

#include "SoftwareSerial.h"

#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10,11); // (Tx, Rx)

DFRobotDFPlayerMini myDFPlayer;

SETUP

mySoftwareSerial.begin(9600);

myDFPlayer.begin(mySoftwareSerial);

myDFPlayer.volume(20);  //Volumen de 0 a 30

myDFPlayer.play(0006); // Reproduce archivo 6, con nombre 0006.mp3

 

 

Librería DFRobotDFPlayerMini.h, aquí.

Data Sheet fabricante, aquí

Otros módulos y comparativas DFRobot, aquí.

 

  LAMINAS  

 

 

 

  SKETCH Lab -10a

 

/*******************************************

 *******************************************

 ***       REPRODUCTOR DF PLAYER          ***

 ***                Ing. Brain Naser Soto                  ***

 ***                                                                  ***

 ***                  WWW.NASER.CL                  ***

 *******************************************

 ******************************************/

 

//#include "Arduino.h"

#include "SoftwareSerial.h"

#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10,11); // (Tx, Rx)

DFRobotDFPlayerMini myDFPlayer;

int mensaje=1;

 

void setup()

{

  pinMode (2, INPUT); // Switch

  mySoftwareSerial.begin(9600);

  myDFPlayer.begin(mySoftwareSerial);

 

  myDFPlayer.volume(20);  //Volumen de 0 a 30

  myDFPlayer.play(0006); // Reproduce archivo 6

  delay (500);

}

 

void loop() {

   boolean sw = digitalRead (2);

 

  if (sw == LOW){

    myDFPlayer.play(mensaje);

    mensaje++;

    }

 

delay (500);

if (mensaje>5){

  mensaje=1;

  }

 

}

 

 

 

 

 

 SKETCH Lab -10b, con Busy

 

/*******************************************

 *******************************************

 ***       REPRODUCTOR DF PLAYER          ***

 ***                Ing. Brain Naser Soto                  ***

 ***                                                                  ***

 ***                  WWW.NASER.CL                  ***

 *******************************************

 ******************************************/

 

//#include "Arduino.h"

#include "SoftwareSerial.h"

#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10,11); // (Tx, Rx)

DFRobotDFPlayerMini myDFPlayer;

int mensaje=1;

 

void setup()

{

  pinMode (2, INPUT); // Switch

  pinMode (12, INPUT); // Busy

  mySoftwareSerial.begin(9600);

  myDFPlayer.begin(mySoftwareSerial);

 

  myDFPlayer.volume(20);  //Volumen de 0 a 30

  myDFPlayer.play(0006);

  delay (500);

}

 

void loop() {

   boolean busy = digitalRead (3); // lee estado de Busy

   boolean sw = digitalRead (2); // lee estadop del Switch

 

  if (sw == LOW){

    myDFPlayer.play(mensaje);

    mensaje++;

    }

delay (500);

if (mensaje>5){

  mensaje=1;

  }

 

}