At last IchigoJam supports Wii Nunchuck via I2C pins.
This is a sample program.
Let's make games, robots and tools using Wii Nunchuck!
100 GSB @NCINIT 110 @LOOP 120 GSB @NCGET 130 ?DEC$(X,3),DEC$(Y,3),Z,DEC$(A,4),DEC$(B,4),DEC$(C,4) 140 GOTO @LOOP 400 @NCINIT 410 POKE#700,#F0,#55:IF I2CW(#52,#700,2,#700,0) ERR 420 POKE#700,#40,0:IF I2CW(#52,#700,2,#701,0) ERR 430 RTN 500 @NCGET 510 IF I2CW(#52,#701,1,#701,0) ERR 520 IF I2CR(#52,#701,0,#702,6) ERR 530 X=PEEK(#702):Y=PEEK(#703):Z=PEEK(#707)&3 540 A=PEEK(#704)<<2+Z>>2&3 550 B=PEEK(#705)<<2+Z>>4&3 560 C=PEEK(#706)<<2+Z>>6&3 570 RTN
3 accelerometers are 10bit.
But if it's enough just 8bit, it becomes simpler.
100 GSB @NCINIT 110 @LOOP 120 GSB @NCGET 130 ?DEC$(X,3),DEC$(Y,3),Z,DEC$(A,4),DEC$(B,4),DEC$(C,4) 140 GOTO @LOOP 400 @NCINIT 410 POKE#700,#F0,#55:IF I2CW(#52,#700,2,#700,0) ERR 420 POKE#700,#40,0:IF I2CW(#52,#700,2,#701,0) ERR 430 RTN 500 @NCGET 510 IF I2CW(#52,#701,1,#701,0) ERR 520 IF I2CR(#52,#701,0,#702,6) ERR 530 X=PEEK(#702):Y=PEEK(#703):Z=PEEK(#707)&3 540 A=PEEK(#704):B=PEEK(#705):C=PEEK(#706) 550 RTN
Wii Nunchuck has 2 versions. If yours doesn't work, try this patch
510 POKE#700,#FB,#00:IF I2CW(#52,#700,2,#700,0) ERR
I use the adapter to connect IchigoJam and Wii Nunchuck.
Or connect directly without any adapters!?
"Wii拡張コネクタ - ネットワーク管理者の憂鬱な日常"
links
- IchigoJam-FAN - you can dowload this beta version firmware
- Wii Nunchuk Interface
- IchigoJam