[[FrontPage]]
 objectPage http://www.yama-lab.org/fwb4pi/index.php?i2c-opt3001-ex1 or http://www.yama-lab.org/fwb4pi/index.php?i2c-opt3001-ex1
 device yamaRasPiDp9_1 or yamaRasPiDp9_2 start after no write for 10 min.
 command: set readInterval=30000
 command: set execInterval=0
 command: set reportLength=120
 command: program sensors
 program: 'ex("service","clear sendBuffer")
 program: '
 program: ' init i2c
 program: ex("pi4j", "i2c use 1")
 program: '
 program: ' init lux sensor ...OPT3001
 program: ex("pi4j", "i2c write2 0x44, 0x01, 0xc6, 0x10")
 program: delay(15)
 program: '
 program: 'get the lux value
 program: ex("pi4j", "i2c write-b 0x44,0x00")
 program: delay(15)
 program: 'vs=ex("pi4j", "i2c read2 0x44,0x00") ' get lux
 program: vs=ex("pi4j", "i2c read-A-2 0x44")
 program: vi=s2i(vs)
 program: vMantissa=(vi & 0x0fff)*1.0
 program: vExponent=(vi & 0xf000)/(2^12)
 program: v=vMantissa*(0.01 * 2^vExponent)
 program: ex("service","putSendBuffer device=lux, Date="+ex("service","getCurrentDate.")+", v="+v)
 program: '
 program: '
 program: ex("pi4j", "i2c close.")
 program: ex("service","sendResults.")
 command: end sensors
 command: run sensors
 result:
 device=lux, Date=2019/4/3/ 2:14:50, v=0.0
 device=lux, Date=2019/4/3/ 2:15:20, v=0.0
 device=lux, Date=2019/4/3/ 2:15:50, v=0.0
 device=lux, Date=2019/4/3/ 2:16:20, v=0.0
 device=lux, Date=2019/4/3/ 2:16:50, v=0.0
 device=lux, Date=2019/4/3/ 2:17:20, v=0.0
 device=lux, Date=2019/4/3/ 2:17:50, v=0.0
 device=lux, Date=2019/4/3/ 2:18:20, v=0.0
 device=lux, Date=2019/4/3/ 2:18:50, v=0.0
 device=lux, Date=2019/4/3/ 2:19:20, v=0.0
 device=lux, Date=2019/4/3/ 2:19:50, v=0.0
 device=lux, Date=2019/4/3/ 2:20:20, v=0.0
 currentDevice="yamaRasPiDp1_1",Date=2019/4/3/ 2:20:20

 device=lux, Date=2019/4/3/ 2:20:50, v=0.0
 currentDevice="yamaRasPiDp1_1",Date=2019/4/3/ 2:20:50


トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS