LightSensor1

objectPage http://www.yama-lab.org/fwb4pi/index.php?Servo1 or http://www.yama-lab2.org/dp-1/index.php?Servo1
device yamaRasPiDp9_1 or yamaRasPiDp9_2 start after no write for 10 min.
command: set readInterval=300000
command: set execInterval=0
command: program i2cServo
program: dim thisTable
program: dim thisRowLabel
program: dim thisColumnLabel
program: '
program: ' init i2c
program: ex("pi4j", "i2c use 1")
program: '
program: ' init servo
program: ex("pi4j", "i2c write1 0x40,0x00,0x00") 'init servo, clear mode-1
program: sms=ex("pi4j", "i2c read1 0x40,0x00") 'read current mode-1
program: sm=s2i(sms)
program: nsm=(0x007f & sm)|0x0010
program: ex("pi4j", "i2c write1 0x40,0x00,"+nsm) 'set the sleep mode on, restart disabled     40> 00+ 10+
program: ex("pi4j", "i2c write1 0x40,0xfe,0x70") 'set the pwm frequency prescale register   40> fe+ 70+
program: ex("pi4j", "i2c write1 0x40,0x00,"+sm) 'recover the mode-1 register, .... wake up.  40> 00+ 00+ 
program: delay(10)
program: smi=sm | 0x00a1
program: ex("pi4j", "i2c write1 0x40,0x00,"+smi) ' set the mode-1 register to incremental mode.   40> 00+ a1+
program: ex("service","clear sendBuffer")
program: for i=1 to 30
program:     sensorPageUrl="http://www.yama-lab.org/fwb4pi/index.php?lightSensor1"
program:     sensorPage=ex("connector", "getpage "+prevsensorPageUrl)
program:     sensorPageR=getResultPart(sensorPage)
program:     parseCsv(sensorPageR, thisTable, thisRowLabel, thisColumnLabel)
program:     ix=getindex(thisTable, thisRowLabel, thisColumnLabel("device"),"=","light")
program:     rv=thisTable(ix,thisColumnLabel("v"))
program:     ex("service","putSendBuffer device=light, Date="+ex("service","getCurrentDate.")+", rv="+rv);
program:     if rv>60 then 'move ch0 to center 
program:     {
program:        ex("pi4j", "i2c write4 0x40,0x06,0x96,0x00")
program:     }
program:     else
program:     {
program:        ex("pi4j", "i2c write4 0x40,0x06,0x258,0x00")
program:     }
program:     delay(10000)
program: next i
program: ex("pi4j", "i2c close.")
program: ex("service","sendResults."); 
command: end i2cServo
command: run i2cServo
result:
device=light, Date=2016/10/2/ 1:13:54, v=2
currentDevice="yamaRasPiDp1_1",Date=2016/10/2/ 1:13:54

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS