Bien avancé mais cela ne marche plus :-(
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
-- source: https://nodemcu.readthedocs.io/en/master/modules/ds18b20/
|
-- source: https://nodemcu.readthedocs.io/en/master/modules/ds18b20/
|
||||||
|
|
||||||
function a1()
|
function a1()
|
||||||
print("\n a1.lua zf190601.1627 \n")
|
print("\n a1.lua zf190616.1453 \n")
|
||||||
end
|
end
|
||||||
|
|
||||||
a1()
|
a1()
|
||||||
@@ -13,10 +13,23 @@ ds18b20.setup(ow_pin)
|
|||||||
|
|
||||||
print("toto182538")
|
print("toto182538")
|
||||||
|
|
||||||
|
ztemp1=0 ztemp2=0 ztemp3=0
|
||||||
|
|
||||||
-- read all sensors and print all measurement results
|
-- read all sensors and print all measurement results
|
||||||
ds18b20.read(
|
ds18b20.read(
|
||||||
function(ind,rom,res,temp,tdec,par)
|
function(ind,rom,res,temp,tdec,par)
|
||||||
print(ind,string.format("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",string.match(rom,"(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)")),res,temp,tdec,par)
|
-- print(ind,string.format("%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",string.match(rom,"(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)")),res,temp,tdec,par)
|
||||||
|
print(ind,temp)
|
||||||
|
if ind == 1 then
|
||||||
|
ztemp1 = temp
|
||||||
|
elseif ind == 2 then
|
||||||
|
ztemp2 = temp
|
||||||
|
elseif ind == 3 then
|
||||||
|
ztemp3 = temp
|
||||||
|
--C'est la fin de lecture, on envoie les mesures à ThingSpeak
|
||||||
|
print(ztemp1,ztemp2,ztemp3)
|
||||||
|
disp_send()
|
||||||
|
end
|
||||||
end,{})
|
end,{})
|
||||||
|
|
||||||
print("tutu152603")
|
print("tutu152603")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
-- Scripts à charger après le boot pour démarrer son appli
|
-- Scripts à charger après le boot pour démarrer son appli
|
||||||
|
|
||||||
print("\n boot.lua zf190601.1615 \n")
|
print("\n boot.lua zf190616.1425 \n")
|
||||||
|
|
||||||
function heartbeat()
|
function heartbeat()
|
||||||
f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end
|
f= "flash_led_xfois.lua" if file.exists(f) then dofile(f) end
|
||||||
@@ -21,6 +21,7 @@ f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end
|
|||||||
f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end
|
f= "telnet_srv2.lua" if file.exists(f) then dofile(f) end
|
||||||
f= "web_ide2.lua" if file.exists(f) then dofile(f) end
|
f= "web_ide2.lua" if file.exists(f) then dofile(f) end
|
||||||
f= "web_srv2.lua" if file.exists(f) then dofile(f) end
|
f= "web_srv2.lua" if file.exists(f) then dofile(f) end
|
||||||
|
f= "web_cli.lua" if file.exists(f) then dofile(f) end
|
||||||
--f= "set_time.lua" if file.exists(f) then dofile(f) end
|
--f= "set_time.lua" if file.exists(f) then dofile(f) end
|
||||||
--f= "dsleep.lua" if file.exists(f) then dofile(f) end
|
--f= "dsleep.lua" if file.exists(f) then dofile(f) end
|
||||||
--f= "a_no_linear.lua" if file.exists(f) then dofile(f) end
|
--f= "a_no_linear.lua" if file.exists(f) then dofile(f) end
|
||||||
|
|||||||
32
Temp_DS18B20/tst_ds18b20/web_cli.lua
Normal file
32
Temp_DS18B20/tst_ds18b20/web_cli.lua
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
-- Petit script pour envoyer quelque chose sur un serveur WEB
|
||||||
|
print("\n web_cli.lua zf190616.1513 \n")
|
||||||
|
|
||||||
|
|
||||||
|
function disp_send()
|
||||||
|
print("web_cli: ")
|
||||||
|
ztemp1=11 ztemp2=12 ztemp3=13
|
||||||
|
|
||||||
|
zurl=thingspeak_url_update.."field1="..tostring(ztemp1).."&field2="..tostring(ztemp2).."&field3="..tostring(ztemp3)
|
||||||
|
print(zurl)
|
||||||
|
http.get(zurl, nil, function(code, data)
|
||||||
|
print("toto")
|
||||||
|
if (code < 0) then
|
||||||
|
print("tutu")
|
||||||
|
print("HTTP request failed")
|
||||||
|
print("zuzu", code, data)
|
||||||
|
else
|
||||||
|
print("titi")
|
||||||
|
print(code, data)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
--disp_send()
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
disp_send()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
]]
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
-- Petit script pour configurer le client WIFI du NodeMCU
|
-- Petit script pour configurer le client WIFI du NodeMCU
|
||||||
|
|
||||||
function wifi_cli_conf()
|
function wifi_cli_conf()
|
||||||
print("\n wifi_cli_conf.lua zf190601.1328 \n")
|
print("\n wifi_cli_conf.lua zf190616.1346 \n")
|
||||||
|
|
||||||
--credentials par défaut
|
--credentials par défaut
|
||||||
--cli_ssid="3g-s7"
|
--cli_ssid="3g-s7"
|
||||||
@@ -9,7 +9,7 @@ function wifi_cli_conf()
|
|||||||
cli_pwd="12234567"
|
cli_pwd="12234567"
|
||||||
|
|
||||||
--ses propre credentials
|
--ses propre credentials
|
||||||
f= "credentials_solar.lua" if file.exists(f) then dofile(f) end
|
f= "credentials_tst_ds18b20.lua" if file.exists(f) then dofile(f) end
|
||||||
|
|
||||||
wifi.sta.config{ssid=cli_ssid, pwd=cli_pwd, save=true}
|
wifi.sta.config{ssid=cli_ssid, pwd=cli_pwd, save=true}
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user