create every day - 福野泰介の一日一創

IchigoJam's I2C connects Raspberry Pi Sense HAT and Wii Nunchuck

2017/03/15 23:55:00
#IchigoJam #maker #english 

I2C can connect many devices!
I made a 8x8 simple paint tool using Raspberry Pi Sense HAT and Wii Nunchuck on IchigoJam.

JoyStick - Move the Cursor
Button 1 - Put a Red Dot
Button 2 - Put a Green Dot
Button 1 and 2 - Clear Screen

I updated IchigoJam - with 1.2b42 firmware (beta download from Facebook Group)
To use this program download it! You can't run on IchigoJam ver 1.2.1.

1 'Sense Paint 10 GSB@CLS:GSB@NINIT 15 @LOOP 20 GSB@NGET:X=X/27-1:Y=8-Y/27 30 N=20:GSB@PUTR 40 IF B=1 GSB@PUTB 45 IF B=2 GSB@PUTG 46 IF B=3 GSB@CLS 50 WAIT5:N=0:GSB@PUTR 60 GOTO@LOOP 100 'sense hat mat-led 105 @DRAW:IF I2CW(#46,0,#700,192) STOP ELSE RTN 110 @CLS:FORI=0TO192:POKE#700+I,0:NEXT:GSB@DRAW:RTN 120 @PUTR:POKE#700+X+Y*24,N:GSB@DRAW:RTN 125 @PUTG:POKE#700+X+Y*24+8,N:GSB@DRAW:RTN 130 @PUTB:POKE#700+X+Y*24+16,N:GSB@DRAW:RTN 500 'nunchuck 505 @NINIT 510 POKE#7C0,#F0,#55:IF I2CW(#52,#7C0,2) STOP 520 POKE#7C0,#40,0:IF I2CW(#52,#7C0,2) STOP 525 RTN 530 @NGET:IF I2CW(#52,0) OR I2CR(#52,#7C2,6) STOP 540 X=PEEK(#7C2):Y=PEEK(#7C3):B=~PEEK(#7C7)

Tweet
クリエイティブ・コモンズ・ライセンス
この作品は「Creative Commons — CC BY 4.0」の下に提供されています。
CC BY 福野泰介 - Taisuke Fukuno / @taisukef / high-res profile image