2017-03-11
Raspberry Pi Sense HAT used with Astro Pi released!
This board has 64 full color LEDs, a joystick, Gyroscope, Accelerometer, Magnetometer, Temperature, Barometric pressure and Humidity. You can access all devices via I2C.

This is a demo video using the Matrix LED controlled by IchigoJam I2CR/I2CW command.

You can connect just 5 pins (5V, GND, 3.3V, GPIO2:SDA and GPIO3:SCL) *see GPIO on RPi
You have to add external pull up(2-3kΩ to 3.3V) SDA and SCL on IchigoJam.

Program on your IchigoJam

10 FOR I=0 TO 192:POKE#701+I,RND(2):NEXT 20 POKE#700,0:IF I2CW(#46,#700,1,#701,192) STOP 30 GOTO10

I made a board to connect the HAT from IchigoJam.



This program shows IchigoJam characters to the matrix LED by your joystick manipulations!

1 'SenseHAT 10 GOTO300 100 'C:CHR P:COL B:BG 105 P=RND(#FFF)+1:B=RND(2)<<8+RND(2)<<4+RND(2) 110 FOR I=0 TO 7 115 N=PEEK(C*8+I):A=#701+I*24 120 FOR J=0 TO 7 125 D=B:IF 128>>J&N D=P 130 POKEA+J,D&#F 140 POKEA+J+8,D>>4&#F 150 POKEA+J+16,D>>8 160 NEXT 170 NEXT 180 GSB200:RTN 199 'send LED data 200 POKE#700,0:IF I2CW(#46,#700,1,#701,192) STOP 210 RTN 299 'main (joystick) 300 POKE#700,#F2:IF I2CR(#46,#700,1,#700,1) STOP 310 K=PEEK(#700) 320 IF K=2 C=C+1:GSB100 330 IF K=16 C=C-1:GSB100 333 IF K=1 C=ASC("A"):GSB100 334 IF K=4 GOTO 500 336 IF K=8 GOTO 400 340 GOTO 300 399 'demo 400 FOR C=0 TO 223:GSB100:NEXT:CONT 500 FOR I=0 TO 192:POKE#701+I,RND(2)*4:NEXT:GSB200:CONT

I accessed a ID EEPROM written settings also.
Connect GPIO27:ID_SD GPIO28:ID_SC (don't have to pull up) *see doc

5 'header 6 P=12 10 POKE#800,0,0:IF I2CR(#50,#800,2,#802,P) ERR 20 N=[4]:?STR$(#802,3),"N:";N,"len:";[5],[6] 30 'atom 35 FOR I=1 TO N 40 POKE#800,0,P:IF I2CR(#50,#800,2,#802,128) ERR 50 ?"type:";[1],"cnt:";[2],"len:";[3] 60 'vendor info 70 IF [1]=1 L=PEEK(#802+28):?STR$(#802+30,L),STR$(#802+30+L,PEEK(#802+29)) 80 'GPIO map 90 IF [1]=2 ?"drive:";PEEK(#802+8),"power:";PEEK(#803+8):FOR J=0 TO 27:?"GPIO";J;":";PEEK(#804+8+J):NEXT 95 'DT blob 96 IF [1]=3 FOR J=0 TO 100:C=PEEK(#802+8+J):?CHR$(C);:NEXT:? 100 P=P+8+[3]:NEXT

Try another HATs!

links
- Sense HAT
- Rainbow HAT
- Raspberry Pi Boards, Kits, HATs, and Accessories - Next Day Delivery - Pimoroni
- the code of Micro Dot pHAT

Tweet
クリエイティブ・コモンズ・ライセンス
本ブログの記事や写真は「Creative Commons — CC BY 4.0」の下に提供します。記事内で紹介するプログラムや作品は、それぞれに記載されたライセンスを参照ください。
CC BY / @taisukef / アイコン画像 / プロフィール画像 / 「一日一創」画像 / RSS