Add Example to yeelink lib
This commit is contained in:
parent
a60f28cf9c
commit
effb57247c
|
@ -0,0 +1,25 @@
|
|||
-- ***************************************************************************
|
||||
-- Example for Yeelink Lib
|
||||
--
|
||||
-- Written by Martin
|
||||
--
|
||||
--
|
||||
-- MIT license, http://opensource.org/licenses/MIT
|
||||
-- ***************************************************************************
|
||||
|
||||
wifi.setmode(wifi.STATION) --Step1: Connect to Wifi
|
||||
wifi.sta.config("SSID","Password")
|
||||
|
||||
dht = require("dht_lib") --Step2: "Require" the libs
|
||||
yeelink = require("yeelink_lib")
|
||||
|
||||
yeelink.init(23333,23333,"You api-key",function() --Step3: Register the callback function
|
||||
|
||||
print("Yeelink Init OK...")
|
||||
tmr.alarm(1,60000,1,function() --Step4: Have fun~ (Update your data)
|
||||
|
||||
dht.read(4)
|
||||
yeelink.update(dht.getTemperature())
|
||||
|
||||
end)
|
||||
end)
|
Loading…
Reference in New Issue