In this tutorial, I will be telling you how to hack a wii remote. I decided to do this because of a comment:
Can You Post The Code that you used for it & how to hack or reconfigure the wii remote? That would be awesome!
Step 1: Get yourself a bluetooth adapter (you can get one easily from ryanteck) and a Wii remote.
Step 2: Install the required libraries and drivers by typing the following commands into a terminal window:
sudo apt-get update
sudo apt-get install python-cwiid bluetooth
Step 3: Put your pi in discoverable mode by typing the following into a terminal window:
sudo hciconfig hci0 piscan
This will go through each bit of python code to do different things on the wii remote.
Type this in import the library:
Type this in to connect to the wii remote:
wm = cwiid.Wiimote()
Once you run that line of code, make sure to put your remote in discoverable mode by pressing the 1 and 2 keys at the same time.
This line can fail and raise a RuntimeError if it fails to connect to the remote, so you’ll want to handle this and keep attempting to connect until you’re successful
Type this in to tell the wii remote to report back the button state:
wm.rpt_mode = cwiid.RPT_BTN
Press a button and type this in to get its value:
You can use the values for different buttons later to compare them with the value returned by this code in a program to see if a certain button is pressed.
Type this in to change the current leds lit on the wii remote:
wm.led = replace this value with led value
The led values go up in binary, ie. led 1 is 1, led 2 is 2, led 1 and 2 is 3, led 3 is 4, ect.
Type this in to make the wii remote vibrate:
wm.rumble = True
Replace the value True in the above code with False to make the wii remote stop vibrating.
I think that hacking a wii remote is quite easy once you know how to and I really hope this tutorial helped!