From 3c2288cc47dc8234b2428261c74d9e2c8e585352 Mon Sep 17 00:00:00 2001 From: Martin Han Date: Fri, 30 Jan 2015 20:32:46 +0800 Subject: [PATCH] BH1705 Manual --- lua_modules/bh1705_EN.md | 106 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 lua_modules/bh1705_EN.md diff --git a/lua_modules/bh1705_EN.md b/lua_modules/bh1705_EN.md new file mode 100644 index 00000000..d6032678 --- /dev/null +++ b/lua_modules/bh1705_EN.md @@ -0,0 +1,106 @@ +# BH1705 Module + +##Require +```lua +bh1705 = require("bh1705") +``` +## Release +```lua +bh1705 = nil +package.loaded["bh1705"]=nil +``` + +##init() +####Description +Setting the I2C pin of BH1705.
+ +####Syntax +init(sda, scl) + +####Parameters +sda: 1~12, IO index.
+scl: 1~12, IO index.
+ +####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 +**-** []() + + +##read() +####Description +Read Lux data from bh1705.
+ +####Syntax +read() + +####Parameters +nil.
+ +####Returns +nil.
+ +####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 +**-** []() + + +##getlux() +####Description +Get lux from bh1705.
+ +####Syntax +getlux() + +####Parameters +nil.
+ +####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 +**-** []() +