ArduinoGravity

How to structure Commands to the DFR0534 Voice Player?

userHead Andrew.Bray 2023-11-22 22:23:00 494 Views1 Replies

Hi - I'm trying to use a DFR0534 in an Arduino Nano project. Using the code example from the product's Wiki, I have the following bit of code


 

//Function to play a track

 void play(unsigned char Track)

{  

 unsigned char play[6] = {0xAA,0x07,0x02,0x00,Track,Track+0xB3};

   mySerial.write(play,6);

         delay(1000);

  }

when called with a file number inserted (prefaced by 0x) the function works correctly - for example this plays track #3.

case 3:

    play(0x03);//Play file0003

    break;

I would like to be able to increase and decrease the volume. The Wiki provides Command sentences for increasing , decreasing, and also a command specifying a Volume level (see below). However I don't know how to incorporate these command sentences into a function that I can send to the DFR0534 using the serial connection.

I've searched extensively on the internet, and even tried ChatGPT for coding suggestion, but everything seems to just quote the examples from the Wiki. Any insight or assistance would be greatly appreciated!

 


 

Volume settings(13)

Command: AA 13 01 VOL SM

Return: None

Explanation: AA 13 01 14 D2 Set volume to level 20.

Increase the volume(14)

Command: AA 14 00 BE

Return: None

Reduce the volume(15)

Command: AA 15 00 BF

Return: None

2023-11-23 01:17:31

Hi - If  anyone else comes across this thread ,  this seems to work:

void Reduce()

{  

 unsigned char Reduce[4] = {0xAA,0x15,0x00,0xBF};

   mySerial.write(Reduce,4);

   //Reduce the volume(15) Command: AA 15 00 BF

     delay(1000);

    play(0x01);//Play file0001 as test of volume

  }

 

void Increase()

{  

 unsigned char Increase[4] = {0xAA,0x14,0x00,0xBE};

   mySerial.write(Increase,4);

   //Increase the volume(14) Command: AA 14 00 BE

     delay(1000);

    play(0x01);//Play file0001 as test of volume

  }

 

userHeadPic Andrew.Bray