[[FrontPage]] objectPage http://www.yama-lab.org/fwb4pi/index.php?i2c-sensors-ex4 or http://www.yama-lab.org/fwb4pi/index.php?i2c-sensors-ex4 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 hdc1080 program: ex("pi4j", "i2c write2 0x40,0x02,0x10,0x00") ' config program: ' program: 'get temp program: ex("pi4j", "i2c write-b 0x40,0x00") ' temp program: delay(15) program: v1s=ex("pi4j", "i2c read-A-2 0x40") ' get temp program: 'temp=s2i(v1s)/65536.0*165-40 program: v1=s2i(v1s) program: if v1<0 then v1x=2.0*(v1/2+0x8000) else v1x=1.0*v1 program: temp=v1x/65536.0*165-40 program: ' program: 'delay(20) program: ' program: 'get humidity program: ex("pi4j", "i2c write-b 0x40,0x01") ' get humidity program: delay(15) program: v2s=ex("pi4j", "i2c read-A-2 0x40") 'humid program: v2=s2i(v2s) program: if v2<0 then v3=2.0*(v2/2 + 0x8000) else v3=v2*1.0 program: humid=(v3/65536.0) *100 program: ex("service","putSendBuffer device=temp, Date="+ex("service","getCurrentDate.")+", v="+temp) program: ex("service","putSendBuffer device=humid, Date="+ex("service","getCurrentDate.")+",v="+humid) program: delay(40) 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: ex("service","putSendBuffer device=lux, Date="+ex("service","getCurrentDate.")+", v="+v) program: ' program: ex("pi4j", "i2c close.") program: ex("service","sendResults.") command: end sensors command: run sensors result: device=temp, Date=2019/6/8/ 20:52:56, v=27.5347900390625 device=humid, Date=2019/6/8/ 20:52:56,v=61.07177734375 device=lux, Date=2019/6/8/ 20:52:56, v=16 device=temp, Date=2019/6/8/ 20:53:25, v=27.554931640625 device=humid, Date=2019/6/8/ 20:53:25,v=64.141845703125 device=lux, Date=2019/6/8/ 20:53:25, v=16 device=temp, Date=2019/6/8/ 20:53:55, v=27.554931640625 device=humid, Date=2019/6/8/ 20:53:55,v=61.175537109375 device=lux, Date=2019/6/8/ 20:53:55, v=16 device=temp, Date=2019/6/8/ 20:54:25, v=27.70599365234375 device=humid, Date=2019/6/8/ 20:54:25,v=67.083740234375 device=lux, Date=2019/6/8/ 20:54:25, v=16 currentDevice="yamaRasPiDp1_1",Date=2019/6/8/ 20:54:25 device=temp, Date=2019/6/8/ 20:54:55, v=27.8167724609375 device=humid, Date=2019/6/8/ 20:54:55,v=64.312744140625 device=lux, Date=2019/6/8/ 20:54:56, v=16 currentDevice="yamaRasPiDp1_1",Date=2019/6/8/ 20:54:56