BH1705 Manual

This commit is contained in:
Martin Han 2015-01-30 20:32:46 +08:00
parent 5894df1da6
commit 3c2288cc47
1 changed files with 106 additions and 0 deletions

106
lua_modules/bh1705_EN.md Normal file
View File

@ -0,0 +1,106 @@
# BH1705 Module
##Require
```lua
bh1705 = require("bh1705")
```
## Release
```lua
bh1705 = nil
package.loaded["bh1705"]=nil
```
<a id="bh1705_init"></a>
##init()
####Description
Setting the I2C pin of BH1705.<br />
####Syntax
init(sda, scl)
####Parameters
sda: 1~12, IO index.<br />
scl: 1~12, IO index.<br />
####Returns
nil
####Example
```lua
SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14
bh1750 = require("bh1750")
bh1750.init(SDA_PIN, SCL_PIN)
-- release module
bh1750 = nil
package.loaded["bh1750"]=nil
```
####See also
**-** []()
<a id="bh1705_read"></a>
##read()
####Description
Read Lux data from bh1705.<br />
####Syntax
read()
####Parameters
nil.<br />
####Returns
nil.<br />
####Example
```lua
SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14
bh1705 = require("bh1705")
bh1705.init(SDA_PIN, SCL_PIN)
bh1705.read()
-- release module
bh1705 = nil
package.loaded["bh1705"]=nil
```
####See also
**-** []()
<a id="bh1705_getlux"></a>
##getlux()
####Description
Get lux from bh1705.<br />
####Syntax
getlux()
####Parameters
nil.<br />
####Returns
l: Integer, getlux from bh1705.
####Example
```lua
SDA_PIN = 6 -- sda pin, GPIO12
SCL_PIN = 5 -- scl pin, GPIO14
bh1705 = require("bh1705")
bh1705.init(SDA_PIN, SCL_PIN)
bh1705.read()
l = bh1705.getlux()
print("lux: "..(l / 100).."."..(l % 100).." lx")
-- release module
bh1705 = nil
package.loaded["bh1705"]=nil
```
####See also
**-** []()