diff --git a/Workshop/181015/btn_led.lua b/Workshop/181015/btn_led.lua index 78c4c12..5639ebc 100644 --- a/Workshop/181015/btn_led.lua +++ b/Workshop/181015/btn_led.lua @@ -1,7 +1,7 @@ -- Programme qui allume la led bleue quand on appuie le bouton flash -- zf181011.1749 -print("\n btn_led_front.lua zf181011.1819 \n") +print("\n btn_led.lua zf181016.1957 \n") zledbleue=0 --led bleue diff --git a/Workshop/181015/btn_led_remote/btn/initz.lua b/Workshop/181015/btn_led_remote/btn/initz.lua index c0e1f86..97951ca 100644 --- a/Workshop/181015/btn_led_remote/btn/initz.lua +++ b/Workshop/181015/btn_led_remote/btn/initz.lua @@ -1,6 +1,7 @@ ---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 +--Script de bootstrap, en appuyant sur le bouton ça démarre start_boot, +-- autrement en attendant 8 secondes cela démarre start_boot -print("\n init.lua hv180906.1450\n") +print("\n init.lua zf181017.1026\n") zswitch=3 --switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) @@ -10,10 +11,10 @@ function hvbouton() gpio.trig(zswitch, "none") tmr.unregister(initalarme) dofile("start_boot.lua") - dofile("start_job.lua") +-- dofile("start_job.lua") end ---gpio.trig(zswitch, "both", hvbouton) +gpio.trig(zswitch, "both", hvbouton) tmr.alarm(initalarme, 8000, tmr.ALARM_SINGLE, function() print("\nStart\n") diff --git a/Workshop/181015/btn_led_remote/led/initz.lua b/Workshop/181015/btn_led_remote/led/initz.lua index c0e1f86..97951ca 100644 --- a/Workshop/181015/btn_led_remote/led/initz.lua +++ b/Workshop/181015/btn_led_remote/led/initz.lua @@ -1,6 +1,7 @@ ---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 +--Script de bootstrap, en appuyant sur le bouton ça démarre start_boot, +-- autrement en attendant 8 secondes cela démarre start_boot -print("\n init.lua hv180906.1450\n") +print("\n init.lua zf181017.1026\n") zswitch=3 --switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) @@ -10,10 +11,10 @@ function hvbouton() gpio.trig(zswitch, "none") tmr.unregister(initalarme) dofile("start_boot.lua") - dofile("start_job.lua") +-- dofile("start_job.lua") end ---gpio.trig(zswitch, "both", hvbouton) +gpio.trig(zswitch, "both", hvbouton) tmr.alarm(initalarme, 8000, tmr.ALARM_SINGLE, function() print("\nStart\n") diff --git a/Workshop/181015/btn_led_remote/script1.lua b/Workshop/181015/btn_led_remote/script1.lua deleted file mode 100644 index ff5afc3..0000000 --- a/Workshop/181015/btn_led_remote/script1.lua +++ /dev/null @@ -1,3 +0,0 @@ -a=3 -b=77 -print(a*b) diff --git a/Workshop/181015/hello_world/blink_led1.lua b/Workshop/181015/hello_world/blink_led1.lua new file mode 100644 index 0000000..f5f5249 --- /dev/null +++ b/Workshop/181015/hello_world/blink_led1.lua @@ -0,0 +1,22 @@ +-- programme pour faire clignoter une LED avec un rapport on/off +--zf20180717.1118 + +zLED=0 +zTm_On_LED = 500 --> en ms +zTm_Off_LED = 500 --> en ms +zFlag_LED = 0 + +function blink_LED () + if zFlag_LED==gpio.LOW then + zFlag_LED=gpio.HIGH + tmr.alarm(ztmr_LED, zTm_Off_LED, tmr.ALARM_SINGLE, blink_LED) + else + zFlag_LED=gpio.LOW + tmr.alarm(ztmr_LED, zTm_On_LED, tmr.ALARM_SINGLE, blink_LED) + end + gpio.write(zLED, zFlag_LED) +end + +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +blink_LED () diff --git a/Workshop/181015/init.lua b/Workshop/181015/hello_world/initz.lua similarity index 66% rename from Workshop/181015/init.lua rename to Workshop/181015/hello_world/initz.lua index 6d6d590..97951ca 100644 --- a/Workshop/181015/init.lua +++ b/Workshop/181015/hello_world/initz.lua @@ -1,6 +1,7 @@ ---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 +--Script de bootstrap, en appuyant sur le bouton ça démarre start_boot, +-- autrement en attendant 8 secondes cela démarre start_boot -print("\n init.lua hv180906.1450\n") +print("\n init.lua zf181017.1026\n") zswitch=3 --switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) @@ -10,7 +11,7 @@ function hvbouton() gpio.trig(zswitch, "none") tmr.unregister(initalarme) dofile("start_boot.lua") - dofile("start_job.lua") +-- dofile("start_job.lua") end gpio.trig(zswitch, "both", hvbouton) diff --git a/Workshop/181015/hello_world/rm_files.lua b/Workshop/181015/hello_world/rm_files.lua new file mode 100644 index 0000000..81241cb --- /dev/null +++ b/Workshop/181015/hello_world/rm_files.lua @@ -0,0 +1,12 @@ +-- pour effacer TOUS les fichiers qui se trouve dans la flash du NodeMCU + +print("\n rm_files.lua zf180907.1511 \n") + + +l=file.list() i=0 +for k,v in pairs(l) do + i=i+v + file.remove(k) +end +print("-------------------------------") +print("\nC'est tout effaced :-) \n") diff --git a/Workshop/181015/hello_world/start_boot.lua b/Workshop/181015/hello_world/start_boot.lua new file mode 100644 index 0000000..84a84f4 --- /dev/null +++ b/Workshop/181015/hello_world/start_boot.lua @@ -0,0 +1,7 @@ +-- Scripts à charger au moment du boot + +print("\n start_boot.lua zf181017.1021 \n") + +dofile("blink_led1.lua") + + diff --git a/Workshop/181015/initz.lua b/Workshop/181015/initz.lua new file mode 100644 index 0000000..97951ca --- /dev/null +++ b/Workshop/181015/initz.lua @@ -0,0 +1,23 @@ +--Script de bootstrap, en appuyant sur le bouton ça démarre start_boot, +-- autrement en attendant 8 secondes cela démarre start_boot + +print("\n init.lua zf181017.1026\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) diff --git a/Workshop/181015/start_boot.lua b/Workshop/181015/start_boot.lua index f35e703..84a84f4 100644 --- a/Workshop/181015/start_boot.lua +++ b/Workshop/181015/start_boot.lua @@ -1,28 +1,7 @@ --- Scripts à charger au moment du boot afin de pouvoir travailler avec le robot à distance -print("\n start_boot.lua zf180907.1440 \n") +-- Scripts à charger au moment du boot -dofile("disp_oled.lua") -oled_line1="RESET" -oled_line2="" -oled_line3="" -oled_line4="" -oled_line5="" -disp_oled() +print("\n start_boot.lua zf181017.1021 \n") -oled_line1="Waiting..." -oled_line2="" -oled_line3="" -oled_line4="" -oled_line5="" -disp_oled() +dofile("blink_led1.lua") ---dofile("wifi_cnf_start.lua") -dofile("wifi_ap_stop.lua") -dofile("wifi_cli_start.lua") -dofile("web_srv.lua") -dofile("telnet_srv.lua") -zpeed=50 -turn_on = 700 -zauto=false -dofile("motor.lua")