From 0b8b883e909c17fc9a70cf41502b9e5363de031e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Y=C3=A1=C3=B1ez?= Date: Wed, 21 Jan 2015 08:23:06 +0100 Subject: [PATCH] README.md for DHT22 module --- lua_modules/dht22/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 lua_modules/dht22/README.md diff --git a/lua_modules/dht22/README.md b/lua_modules/dht22/README.md new file mode 100644 index 00000000..737c04db --- /dev/null +++ b/lua_modules/dht22/README.md @@ -0,0 +1,22 @@ +# DHT22 module + +## Example +```lua +PIN = 4 -- data pin, GPIO2 + +dht22 = require("dht22") +dht22.read(PIN) +t = dht22.getTemperature() +h = dht22.getHumidity() + +-- temperature in degrees Celsius and Farenheit +print("Temperature: "..(t/10).."."..(t%10).." deg C") +print("Temperature: "..(9 * t / 50 + 32).."."..(9 * t / 5 % 10).." deg F") + +-- humidity +print("Humidity: "..(h/10).."."..(h%10).."%") + +-- release module +dht22 = nil +package.loaded["dht22"]=nil +```