Go Down

Topic: Problems with an WT5001M02-28P (Read 948 times) previous topic - next topic

cps80

Hello together,
 
I got a problem and i hope you can help me. I also started a Project with an Arduino Mini Pro, and a WT5001M02-28P. I use the code below and the problem is that all sounds are playing in loop and wont stop, from the start sound beginnning and then it plays the blast sound throughout without pressing a button. i started to test the programming of the arduino and let it play only one file without buttons or something, that was the same effect and it plays in loop.

The Code:

void setup() {
 
 
// start sound
Serial.write(0x7E);
Serial.write(0x04);
Serial.write(0xA0); // A0 for SD card
Serial.write(0x00);
Serial.write(0x3d); // track number
Serial.write(0x7E);
}
 
void loop() {
}
 



it only will stop if i add this code

delay(XXXXXX);
 
Serial.write(0x7E);
Serial.write(0x02); //STOP Sound
Serial.write(0xA4);
Serial.write(0x7E);
 
after every sound file. but thats no solution for me because i want to programm it also with random sound and then it will not work because of the delay.  Is there anyone who can help me please?

Grumpy_Mike

#1
Mar 07, 2016, 07:10 pm Last Edit: Mar 07, 2016, 07:11 pm by Grumpy_Mike
Quote
the problem is that all sounds are playing in loop and wont stop,
Your loop function is empty. There is no reading of a push button to allow you to stop the sound.

Please post the code you are having trouble with and post it correctly, by reading How to use this forum

Quote
i want to programm it also with random sound
Fine you can do that without using delay and by sending it the stop sound commands you said worked.

Can you write code?

mattnelson521

I'm having the same issue as cps80. I have tried 2 different codes and its the same thing. Think you might be able to take a look at it for me? I think it might help him as well. I would like to get both codes to work but any help would be greatly appreciated.


Code: [Select]

const int buttonPinFire = 7;   // FIRE

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
 
   // initialize the button pin as a input:
pinMode(buttonPinFire, INPUT);

// initialize serial communication:
   Serial.begin(9600);
   

   
   Serial.write(0x7E);
   Serial.write(0x03);
   Serial.write(0xA7);
   Serial.write(0x1F); //  volume max
   Serial.write(0x7E);
   
   // start sound
   Serial.write(0x7E);
   Serial.write(0x04);
   Serial.write(0xA0); // A0 for SD card
   Serial.write((byte)0x00);
   Serial.write(0x02); // track number
   Serial.write(0x7E);
   delay(3000);
   
   }
   
   void loop()
{
                     
   
 buttonState = digitalRead(buttonPinFire);
if (buttonState == HIGH) {

   Serial.write(0x7E);
   Serial.write(0x04);
   Serial.write(0xA0); // A0 for SD card
   Serial.write(0x00);
   Serial.write(0x01); // track number
   Serial.write(0x7E);
delay(300);
}
 
         }


and the second code i tried to post on here but it was too long and wouldn't allow me to. I have attached that one.

I only started Arduino stuff and coding about 2 weeks ago so forgive on being a noob at this.


Go Up