pi_neomatrix_clear_ex1.py
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#code(Python){{
# coding: utf-8
from PIL import Image
import smbus
import time
off_x=28
off_y=130
dx=8
dy=2
imax=75
jmax=16
i2c = smbus.SMBus(1) # 注:ラズパイのI2Cポート
#
# command:
# clear... 0x00
# show ... 0x01
# set1 ix,iy,r,g,b
# ... 0x02 *,*, *,*,*
# setn ix,iy,n, r0,g0,b0, ..r(n-1),g(n-1),b(n-1) n<=8
# ... 0x03 *,*, *, *,*,*, ..., *,*,*
#
pixels=[[(0,0,0) for j in range(jmax)] for i in range(ima...
addrs = [0x30,0x31,0x32,0x33]
fourpix=[0x00, 0x00, 0x04, 0,0,0, 0,0,0, 0,0,0, 0,0,0]
i2c.write_byte(addrs[0],0x00)
i2c.write_byte(addrs[1],0x00)
i2c.write_byte(addrs[2],0x00)
i2c.write_byte(addrs[3],0x00)
time.sleep(0.001)
i2c.write_byte(addrs[0],0x01)
i2c.write_byte(addrs[1],0x01)
i2c.write_byte(addrs[2],0x01)
i2c.write_byte(addrs[3],0x01)
}}
終了行:
#code(Python){{
# coding: utf-8
from PIL import Image
import smbus
import time
off_x=28
off_y=130
dx=8
dy=2
imax=75
jmax=16
i2c = smbus.SMBus(1) # 注:ラズパイのI2Cポート
#
# command:
# clear... 0x00
# show ... 0x01
# set1 ix,iy,r,g,b
# ... 0x02 *,*, *,*,*
# setn ix,iy,n, r0,g0,b0, ..r(n-1),g(n-1),b(n-1) n<=8
# ... 0x03 *,*, *, *,*,*, ..., *,*,*
#
pixels=[[(0,0,0) for j in range(jmax)] for i in range(ima...
addrs = [0x30,0x31,0x32,0x33]
fourpix=[0x00, 0x00, 0x04, 0,0,0, 0,0,0, 0,0,0, 0,0,0]
i2c.write_byte(addrs[0],0x00)
i2c.write_byte(addrs[1],0x00)
i2c.write_byte(addrs[2],0x00)
i2c.write_byte(addrs[3],0x00)
time.sleep(0.001)
i2c.write_byte(addrs[0],0x01)
i2c.write_byte(addrs[1],0x01)
i2c.write_byte(addrs[2],0x01)
i2c.write_byte(addrs[3],0x01)
}}
ページ名: