[[FrontPage]]
 objectPage http://www.yama-lab.org/fwb4pi/index.php?LightSensor1 or http://www.yama-lab.org/fwb4pi/index.php?LightSensor1
 device yamaRasPiDp9_1 or yamaRasPiDp9_2 start after no write for 10 min.
 command: set readInterval=15000
 command: set execInterval=0
 command: program i2cLightSensor
 program: '
 program: ' init i2c
 program: ex("pi4j", "i2c use 1")
 program: '
 program: ' init lux sensor 
 program: ex("pi4j", "i2c write1 0x29,0x80,0x03") 'power up the tsl2561 lux sensor
 program: ex("pi4j", "i2c write1 0x29,0x81,0x00")
 program: ex("pi4j", "i2c write1 0x29,0x86,0x00") 'scale
 program: ex("pi4j", "i2c write1 0x29,0x80,0x00") 'power down
 program: ex("pi4j", "i2c write1 0x29,0x80,0x03") ' power up again
 program: delay(50)
 program: '
 program: 'get the lux value
 program: v1=ex("pi4j", "i2c read1 0x29,0x8c")
 program: v2=ex("pi4j", "i2c read1 0x29,0x8d")
 program: v=s2i(v2)*256+s2i(v1)
 program: '
 program: ex("pi4j", "i2c close.")
 program: ex("service","clear sendBuffer")
 program: ex("service","putSendBuffer device=light, Date="+ex("service","getCurrentDate.")+", v="+v);
 program: ex("service","sendResults.")
 command: end i2cLightSensor
 command: run i2cLightSensor
 result:
 device=light, Date=2022/12/8/ 23:54:17, v=200
 device=light, Date=2022/12/8/ 23:54:17, v=20
 currentDevice="yamaRasPiDp1_1",Date=2022/12/8/ 23:54:17

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