I had the WT5001 connected to an Arduino Nano, and it was working fine. I then connected it to an Arduino Micro and now I can't get it to work.
I am using the Serial1 class instead of the Serial class with the Micro btw. That's necessary because on the Micro the Serial class refers to the USB serial. I have the module attached to the RX and TX pins.
And yes I've made sure I've got the pins connected the right way round. I have also checked that the module is getting power. I read 5V at the power pins. However, I did notice when I disable the serial and just set the TX pin high, I read only 4.7v, and on the RX pin if I do the same I read only 4.15v. The RX is not necessary to use the module though and I've tried disconnecting it.
I've even double checked that the module is still working by connecting the Nano back up to it using the same cables and it works just fine.
Here's the code:
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);
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
pinMode(3, OUTPUT);
digitalWrite(3, LOW);
//analogWrite(3, 32);
/*
pinMode(1, OUTPUT);
digitalWrite(1, LOW);
pinMode(0, OUTPUT);
digitalWrite(0, HIGH);
*/
// initialize serial communication:
Serial1.begin(9600);
Serial1.write(0x7E);
Serial1.write(0x03);
Serial1.write(0xA7);
Serial1.write(0x1F); // volume max
Serial1.write(0x7E);
// Play all songs in order.
Serial1.write(0x7E);
Serial1.write(0x03);
Serial1.write(0xA9);
Serial1.write(0x02);
Serial1.write(0x7E);
// start sound
Serial1.write(0x7E);
Serial1.write(0x04);
Serial1.write(0xA0); // A0 for SD card
Serial1.write((byte)0x00);
Serial1.write(0x01); // track number
Serial1.write(0x7E);
//delay(3000);
}
void loop()
{
/*
buttonState = digitalRead(buttonPinFire);
if (buttonState == HIGH) {
Serial1.write(0x7E);
Serial1.write(0x04);
Serial1.write(0xA0); // A0 for SD card
Serial1.write((byte)0x00);
Serial1.write(0x01); // track number
Serial1.write(0x7E);
delay(3000);
}
*/
}