Hello!
I an trying to send serial commands to a MP3 player using the Tx and Rx pins.
http://avrcard.com/products/mp3orator.htmI have been able to get data from the player and display it in the Serial monitor, if I trigger the player by physical connetions.
But I can't send it commands.
According to the documentation I should send "PF: 10000" to play the file "10000.mp3".
It should then send a resonse back "PLAYING 10000.mp3".
But I think i am getting confusion when trying to read and write serial data at the same time.
So how can i send a command and wait for a resonse, and write it to the serial monitor only?
I think waht happens now is, that when I try to write to the serial monitor, I also write to the MP3 player.
So how can i:
1. send a serial command to the mp3 player
2. get a response back and
3. write that to the serial monitor?
my code so far:
char incomingByte; // for incoming serial data
void setup() {
Serial.begin(9600);
}
void loop() {
// Send play command to MP3 via Tx
Serial.write("PF:10000");
//READ REPSONSE FROM MP3 player
// send data only when you receive data:
while (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
//Serial.print("I received: ");
Serial.print(incomingByte);
}
//WAit 5 sec, and play again
delay(5000);
}