Connect HID device to Bluetooth RN42

Hi everyone,

I'm trying to connect a Wii Remote to an Arduino throw a RN42 bluetooth module. The thing is I'm having troubles pairing them because the pin configuration command needs a String and the Wii Remote's pin is hexadecimal and contains 0x00 which is a String null terminator so I think it could be causing troubles.

I know there is another way (bypassing the pairing) of connecting them that is to use the HID (Human Interface Device) mode of the Wii Remote, but for this I need the module to be a HID host. Does anyone know about this?

I looked about HID mode in the RN42's datasheet but it seems to configure as a HID device and not to connect a HID device to it.

Thanks a lot!

The thing is I’m having troubles pairing them because the pin configuration command needs a String

Why? It should need an array of bytes.

The command to set the pin is SP,
I’m using UART to configure it and I’m trying this code, but apparently it isn’t working:

  Serial3.print('S');
  Serial3.print('P');
  Serial3.print(',');
  Serial3.print(0x98);
  Serial3.print(0x21);
  Serial3.print(0xAA);
  Serial3.print(0x1E);
  Serial3.print(0x24);
  Serial3.print(0x00);         
  Serial3.print('\r');

Then it says the pin configured is 1523317030360

I would expect that you would be using Serial3.write() to send the bytes to the bluetooth module.

That does NOT look like you are sending a String.

You could do that with an array:

byte stuff[] = {'S', 'P', ',', 0x98, 0x21, 0xAA, 0x1E, 0x24, 0x00, '\r' };
Serial3.write(stuff, sizeof(stuff));

I've tried what you said but isn't working :confused:

njdussai: I've tried what you said but isn't working :confused:

For some definition of working. We can't see your code or your proof.