pi_i2c_nano_neomatrix_ex1.py
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#code(Python){{
import smbus
import time
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 *,*, *, *,*,*, ..., *,*,*
#
address = 0x30
i2c.write_byte(address,0x00)
cmd=[0x00,0x03, 0xff, 0x00, 0x00]
i2c.write_i2c_block_data(address, 0x02, cmd)
cmd=[0x01,0x02, 0x00, 0xff, 0x00]
i2c.write_i2c_block_data(address, 0x02, cmd)
i2c.write_byte(address,0x01)
}}
終了行:
#code(Python){{
import smbus
import time
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 *,*, *, *,*,*, ..., *,*,*
#
address = 0x30
i2c.write_byte(address,0x00)
cmd=[0x00,0x03, 0xff, 0x00, 0x00]
i2c.write_i2c_block_data(address, 0x02, cmd)
cmd=[0x01,0x02, 0x00, 0xff, 0x00]
i2c.write_i2c_block_data(address, 0x02, cmd)
i2c.write_byte(address,0x01)
}}
ページ名: