| View previous topic :: View next topic |
| Author |
Message |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Tue Mar 17, 2009 7:11 pm Post subject: wii Nunchuk |
|
|
Has anyone played around with a wii nunchuk controller?
Heres a video of a test program/circuit I made using a PICAXE 18X (running at 3.3v).
| Code: | i2cslave $A4, i2cfast, i2cbyte
i2cwrite ($40,$00)
pause 10
lp:
writei2c (0)
pause 10
readi2c (b1,b2,b3,b4,b5,b0)
b13 = b0
b0 = b13 Xor 0x17 + 0x17
'X joy
b13 = b1
b1 = b13 Xor 0x17 + 0x17
poke $50, b1
'Y joy
b13 = b2
b2 = b13 Xor 0x17 + 0x17
poke $51, b2
'X acc
b13 = b3
b3 = b13 Xor 0x17 + 0x17
poke $52, b3
'Y acc
b13 = b4
b4 = b13 Xor 0x17 + 0x17
poke $54, b4
'Z acc
b13 = b5
b5 = b13 Xor 0x17 + 0x17
poke $56, b5
'buttons
poke $58, bit0
poke $59, bit1
'X joy
peek $50, b0
'Y joy
peek $51, b1
'X acc
peek $52, b2
'Y acc
peek $54, b3
'Z acc
peek $56, b4
'buttons
peek $58, b5
peek $59, b6
if b2 < 100 then
high 0
else
low 0
endif
if b2 > 140 then
high 2
else
low 2
endif
if b3 < 100 then
high 3
else
low 3
endif
if b3 > 140 then
high 5
else
low 5
endif
'pause 10
'debug
goto lp |
|
|
| Back to top |
|
 |
|
 |
Alan Site Admin

Joined: 29 Jan 2006 Posts: 1318 Location: Winnipeg, MB
|
Posted: Fri Mar 20, 2009 3:53 am Post subject: |
|
|
| Nice job. Seems to work very well. |
|
| Back to top |
|
 |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Fri Mar 20, 2009 5:11 am Post subject: |
|
|
Thanks
Heres a site with lots of info. _________________ eric |
|
| Back to top |
|
 |
Comeup Semi Newbie
Joined: 01 Apr 2009 Posts: 8
|
Posted: Thu Apr 02, 2009 9:50 pm Post subject: |
|
|
| lol i wish i knew wtf this stuff meant |
|
| Back to top |
|
 |
Turd HG Ruler

Joined: 18 Aug 2007 Posts: 260 Location: Saskatchewan, Canada
|
Posted: Fri Apr 03, 2009 6:00 am Post subject: |
|
|
Just start by reading a bit of the manuals and go to the PICAXE forum  _________________ eric |
|
| Back to top |
|
 |
Xyon HG Junior
Joined: 03 Aug 2009 Posts: 11
|
Posted: Mon Aug 03, 2009 9:39 am Post subject: |
|
|
theres an awesome mod to make it into a whiteboard _________________ firebox voucher discount |
|
| Back to top |
|
 |
|