All, I am attempting to program an RN42 to spoof a nintendo Wiimote. I would like for the RN42 to connect to the Wii just as a Wiimote would. I can not seem to detect the Wii, or connect to it with the code I have so far. I used a Raspi to connect the Wiimote and RN42 in order to capture bluetooth packets. The images are attached above from wireshark. I noticed the RN42 is going into SDP protocol for some reason and not using the HID profile I set it to. I was wondering if anyone could help me fix this RN42 so I can connect it to a Wii console.
Notes: I have utilized the command reference for the RN42 as well as Wiibrew to try and mimic a wiimote, with little success.
#include <SoftwareSerial.h>
int bluetoothTx = 3; // TX-O pin of bluetooth mate, Arduino D2
int bluetoothRx = 2; // RX-I pin of bluetooth mate, Arduino D3
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
Serial.begin(9600); // Begin the serial monitor at 9600bps
bluetooth.begin(115200); // The Bluetooth Mate defaults to 115200bps
bluetooth.print("$"); // Print three times individually
bluetooth.print("$");
bluetooth.print("$"); // Enter command mode
delay(100); // Short delay, wait for the Mate to send back CMD
bluetooth.println("U,9600,N"); // Temporarily Change the baudrate to 9600, no parity
// 115200 can be too fast at times for NewSoftSerial to relay the data reliably
bluetooth.begin(9600); // Start bluetooth serial at 9600
bluetooth.print("$"); // Print three times individually
bluetooth.print("$");
bluetooth.print("$"); // Enter command mode
delay(200); // Short delay
bluetooth.println("SA,0"); // Set authentication to none
delay(200); // Short delay
bluetooth.println("SM,0"); // Set mode to slave
delay(200); // Short delay
bluetooth.println("SH,0100"); // Set HID flag to Joystick
delay(200); // Short delay
bluetooth.println("S~,6"); // Set HID profile
delay(200); // Short delay
bluetooth.println("SC,0000"); // Set HID profile
delay(200); // Short delay
bluetooth.println("SD,2504"); // Set HID profile
delay(200); // Short delay
bluetooth.println("R,1"); // Reboot
delay(400); // Short delay
bluetooth.begin(9600); // Start bluetooth serial at 9600
}
void loop()
{
if(bluetooth.available()) // If the bluetooth sent any characters
{
// Send any characters the bluetooth prints to the serial monitor
Serial.print((char)bluetooth.read());
}
if(Serial.available()) // If stuff was typed in the serial monitor
{
// Send any characters the Serial monitor prints to the bluetooth
bluetooth.print((char)Serial.read());
}
// and loop forever and ever!
}