From 2fbd5ed509964a16057b22e00aa8469d6a522d73 Mon Sep 17 00:00:00 2001 From: HuangRui Date: Wed, 21 Jan 2015 18:43:57 +0800 Subject: [PATCH] Move bmp085.lua to bmp085 folder. Add bmp085.EN.md. --- lua_modules/bmp085/bmp085.EN.md | 166 ++++++++++++++++++++++++++++ lua_modules/{ => bmp085}/bmp085.lua | 0 2 files changed, 166 insertions(+) create mode 100644 lua_modules/bmp085/bmp085.EN.md rename lua_modules/{ => bmp085}/bmp085.lua (100%) diff --git a/lua_modules/bmp085/bmp085.EN.md b/lua_modules/bmp085/bmp085.EN.md new file mode 100644 index 00000000..4811429e --- /dev/null +++ b/lua_modules/bmp085/bmp085.EN.md @@ -0,0 +1,166 @@ +# BMP085 module + +##Require +```lua +bmp085 = require("bmp085") +``` +## Release +```lua +bmp085 = nil +package.loaded["bmp085"]=nil +``` + +##init() +####Description +Setting the i2c pin of bmp085.
+ +####Syntax +init(sda, scl) + +####Parameters +sda: 1~12, IO index.
+scl: 1~12, IO index.
+ +####Returns +nil + +####Example +```lua +bmp085 = require("bmp085") +gpio5 = 1 +gpio4 = 2 +sda = gpio5 +scl = gpio4 +bmp085.init(sda, scl) +-- Don't forget to release it after use +bmp085 = nil +package.loaded["bmp085"]=nil +``` + +####See also +**-** []() + + +##getUP() +####Description +Get calibrated data of pressure from bmp085.
+ +####Syntax +getUP(oss) + +####Parameters +oss: Over sampling setting, which is 0,1,2,3. Default value is 0.
+ +####Returns +p: Integer, calibrated data of pressure from bmp085. + +####Example +```lua +bmp085 = require("bmp085") +sda = 1 +scl = 2 +bmp085.init(sda, scl) +p = bmp085.getUP(oss) +print(p) +-- Don't forget to release it after use +bmp085 = nil +package.loaded["bmp085"]=nil +``` + +####See also +**-** []() + + +##getUP_raw() +####Description +Get raw data of pressure from bmp085.
+ +####Syntax +getUP_raw(oss) + +####Parameters +oss: Over sampling setting, which is 0,1,2,3. Default value is 0.
+ +####Returns +up_raw: Integer, raw data of pressure from bmp085. + +####Example +```lua +bmp085 = require("bmp085") +sda = 1 +scl = 2 +bmp085.init(sda, scl) +up = bmp085.getUP_raw(oss) +print(up) +-- Don't forget to release it after use +bmp085 = nil +package.loaded["bmp085"]=nil +``` + +####See also +**-** []() + + +##getUT() +####Description +Get temperature from bmp085.
+ +####Syntax +getUT(num_10x) + +####Parameters +num_10x: num_10x: bool value, if true, return number of 0.1 centi-degree. Default value is false, which return a string , eg: 16.7.
+ +####Returns +t: Integer or String, if num_10x is true, return number of 0.1 centi-degree, otherwise return a string.The temperature from bmp085.
+ +####Example +```lua +bmp085 = require("bmp085") +sda = 1 +scl = 2 +bmp085.init(sda, scl) +-- Get string of temperature. +p = bmp085.getUT(false) +print(p) +-- Get number of temperature. +p = bmp085.getUT(true) +print(p) +-- Don't forget to release it after use +bmp085 = nil +package.loaded["bmp085"]=nil +``` + +####See also +**-** []() + + +##getAL() +####Description +Get estimated data of altitude from bmp085.
+ +####Syntax +getAL(oss) + +####Parameters +oss: over sampling setting, which is 0,1,2,3. Default value is 0.
+ +####Returns +e: Integer, estimated data of altitude. Altitudi can be calculated by pressure refer to sea level pressure, which is 101325. Pressure changes 100pa corresponds to 8.43m at sea level
+ +####Example +```lua +bmp085 = require("bmp085") +sda = 1 +scl = 2 +bmp085.init(sda, scl) +-- Get string of temperature. +e = bmp085.getAL() +print(p) +-- Don't forget to release it after use +bmp085 = nil +package.loaded["bmp085"]=nil +``` + +####See also +**-** []() diff --git a/lua_modules/bmp085.lua b/lua_modules/bmp085/bmp085.lua similarity index 100% rename from lua_modules/bmp085.lua rename to lua_modules/bmp085/bmp085.lua