Trying to send play/pause HID command via Bluesmirf HD

Hi Everyone,

I'm trying to get started on my first project, but I'm having some difficulties.

What I want to do is send a play / pause command to my Android device via bluetooth.

I've got an Arduino Uno SMD and Bluesmirf HID module.

I can successfully pair the module to my phone, and send plain text, but I'm having difficulty sending a HID raw report command.

Here is my code so far:

void setup() {
Serial.begin(115200); // begin serial communication at 115200 baud rate
}
void loop() {
Serial.println("0xFD,0x03,0x03,0x80,0x00"); // send play/pause
delay(5000); // delay 5 seconds
}

Instead of play / pause, my device simply types out 0xFD,0x03,0x03,0x80,0x00 in plain text.

I feel like if I could get it to send an initial play/pause command, I can figure out the rest.

Any suggestions? Could someone post the appropriate code to send a raw keyboard command?

Your putting the data (“0xFD,0x03,0x03,0x80,0x00”) between speech marks (") so it’s being sent as text. Also your using println so a 0x0D & 0x0A are also being appended to the end, try sending as byte values.
Serial.write(0xFD);
Serial.write(0x03);
Serial.write(0x03);
Serial.write(0x80);
Serial.write(0x00);

Riva:
Your putting the data ("0xFD,0x03,0x03,0x80,0x00") between speech marks (") so it's being sent as text. Also your using println so a 0x0D & 0x0A are also being appended to the end, try sending as byte values.
Serial.write(0xFD);
Serial.write(0x03);
Serial.write(0x03);
Serial.write(0x80);
Serial.write(0x00);

Thanks, I literally just figured this out and was coming back to update my post.

void setup() {
Serial.begin(115200); // begin serial communication at 115200 baud rate
}
void loop() {
Serial.write(0xFD);
Serial.write(0x03);
Serial.write(0x03);
Serial.write(0x80);
Serial.write(0x00);
Serial.write(0xFD);
Serial.write(0x03);
Serial.write(0x03);
Serial.write(0x00);
Serial.write(0x00);

delay(5000); // delay 5 seconds
}

The above works to send a play/pause command, release the key, wait 5 seconds, and do it again.

Verified by playing and pausing the youtube goats yelling like humans video. :slight_smile: