Wireless Nunchuk picaxe interfacing
September 15, 2011
EDIT: problem solved
Does anybody have any experiences of connecting wireless nunchuk to picaxe. I am working on this and can't find anybody who has tried it. Many people have succesfully made it with arduino (and many have had problems). I try to modify attached BASIC code according to arduino codes.( different nunchuks need different codes).
Could some of you multitalented arduino/picaxe gurus help me to figure out how to modify the code? Michael Dreher-a pioneer on this hack- has listed the needed steps(http://www.windmeadow.com/node/42):
1. The initialization sequence must be changed and because it takes some time before the controller is connected via the wireless connection it has to be done in a loop until it works
2. The decryption (^ 0x17 + 0x17) is then no longer needed
3. Send_zero () has to be called 3 times in a row
4. The TWI freq must be set to 400000
5. The controller type can be read to verify that you really have an Nunchuck
6. When an error occours, the controller must be reinitialized
It seems that number 1, 4, and 5 are essential on all nunchuks, need of other changes vary.
If you have any comments or could help with code, it would be very helpfull. I know very little about c languages and try to do this just through trial and error :)
EDIT: This code works (should work)with any cheap copy nunchuk, wireless or not. You should synco your wireless 'chuk during pause of initialization. Some normal knock off nunchuks wont work on i2cfast mode.
Symbol joystick_x = b10
Symbol joystick_y = b11
Symbol Accel_X = b12
Symbol Accel_y = b13
Symbol Accel_z = b14
Symbol Accel_buttons = b15 ' lower 2 bits of accel & Z,C button states
Symbol nunchukaddress = 0xA4
hi2csetup i2cmaster, nunchukaddress, i2cfast, i2cbyte