ça ne marche pas encore
This commit is contained in:
22
Workshop/181004/btn_led_remote/initz.lua
Normal file
22
Workshop/181004/btn_led_remote/initz.lua
Normal file
@@ -0,0 +1,22 @@
|
||||
--Programme qui démarre le robot en appuyant sur le bouton flash et le redémarre si le bouton flash est appuyer pendant 3 secondes
|
||||
|
||||
print("\n init.lua hv180906.1450\n")
|
||||
|
||||
zswitch=3 --switch flash
|
||||
gpio.mode(zswitch, gpio.INT, gpio.PULLUP)
|
||||
initalarme=tmr.create()
|
||||
|
||||
function hvbouton()
|
||||
gpio.trig(zswitch, "none")
|
||||
tmr.unregister(initalarme)
|
||||
dofile("start_boot.lua")
|
||||
dofile("start_job.lua")
|
||||
end
|
||||
|
||||
--gpio.trig(zswitch, "both", hvbouton)
|
||||
|
||||
tmr.alarm(initalarme, 8000, tmr.ALARM_SINGLE, function()
|
||||
print("\nStart\n")
|
||||
dofile("start_boot.lua")
|
||||
-- dofile("start_job.lua")
|
||||
end)
|
||||
7
Workshop/181004/btn_led_remote/start_boot.lua
Normal file
7
Workshop/181004/btn_led_remote/start_boot.lua
Normal file
@@ -0,0 +1,7 @@
|
||||
-- Scripts à charger au moment du boot afin de pouvoir travailler avec le robot à distance
|
||||
print("\n start_boot.lua zf180907.1440 \n")
|
||||
|
||||
dofile("wifi_cli_conf.lua")
|
||||
dofile("wifi_cli_start.lua")
|
||||
dofile("web_led_onoff.lua")
|
||||
|
||||
12
Workshop/181004/btn_led_remote/wifi_get_ip.lua
Normal file
12
Workshop/181004/btn_led_remote/wifi_get_ip.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
-- Petit script pour obtenir l'adresse IP du NodeMCU connecté sur un AP Wifi
|
||||
print("\n wifi_get_ip.lua zf180824.2000 \n")
|
||||
|
||||
wifitimer1=tmr.create()
|
||||
tmr.alarm(wifitimer1, 1000, tmr.ALARM_AUTO , function()
|
||||
if wifi.sta.getip() == nil then
|
||||
print("Connecting to AP...")
|
||||
else
|
||||
tmr.stop(wifitimer1)
|
||||
dofile("wifi_info.lua")
|
||||
end
|
||||
end)
|
||||
28
Workshop/181004/btn_led_remote/wifi_info.lua
Normal file
28
Workshop/181004/btn_led_remote/wifi_info.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- Petit script pour afficher les infos actuel du WIFI
|
||||
print("\n wifi_info.lua zf180824.2000 \n")
|
||||
|
||||
local zmodewifi=wifi.getmode()
|
||||
|
||||
if zmodewifi == wifi.NULLMODE then
|
||||
print("WIFI OFF")
|
||||
elseif zmodewifi == wifi.STATION then
|
||||
print("WIFI mode CLI")
|
||||
print("Connected IP:\n",wifi.sta.getip())
|
||||
do
|
||||
local sta_config=wifi.sta.getconfig(true)
|
||||
print(string.format("Current client config:\n\tssid:\"%s\"\tpassword:\"%s\"\n\tbssid:\"%s\"\tbssid_set:%s", sta_config.ssid, sta_config.pwd, sta_config.bssid, (sta_config.bssid_set and "true" or "false")))
|
||||
end
|
||||
elseif zmodewifi == wifi.SOFTAP then
|
||||
print("WIFI mode AP")
|
||||
print("AP MAC:\n\t"..wifi.ap.getmac())
|
||||
print("AP IP:\n\t"..wifi.ap.getip())
|
||||
elseif zmodewifi == wifi.STATIONAP then
|
||||
print("WIFI mode CLI+AP")
|
||||
print("Connected IP:\n",wifi.sta.getip())
|
||||
do
|
||||
local sta_config=wifi.sta.getconfig(true)
|
||||
print(string.format("Current client config:\n\tssid:\"%s\"\tpassword:\"%s\"\n\tbssid:\"%s\"\tbssid_set:%s", sta_config.ssid, sta_config.pwd, sta_config.bssid, (sta_config.bssid_set and "true" or "false")))
|
||||
end
|
||||
print("AP MAC: "..wifi.ap.getmac())
|
||||
print("AP IP: "..wifi.ap.getip())
|
||||
end
|
||||
Reference in New Issue
Block a user