From c6f823d33a80fcd8660f424d71c925ef9d1ab024 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Sun, 25 Nov 2018 13:20:27 +0100 Subject: [PATCH] =?UTF-8?q?-=20compl=C3=A9tement=20refactoris=C3=A9=20la?= =?UTF-8?q?=20branche=20LED=20RG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Boot init.lua/mini/test webide/repair.lua | 4 +- {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC.tar | Bin .../Alex/PoC/cat.lua | 0 .../Alex/PoC/dir.lua | 0 .../Alex/PoC/dossier sans titre/initz.lua | 0 .../Alex/PoC/index.html | 0 .../Alex/PoC/initz.lua | 0 .../Alex/PoC/just_test_3x.lua | 0 .../Alex/PoC/just_test_6x.lua | 0 .../Alex/PoC/rm_files.lua | 0 .../Alex/PoC/start_boot.lua | 0 .../Alex/PoC/webleds.lua | 0 .../Alex/PoC/wifiap.lua | 0 .../WS2813_18031509433725.pdf | Bin LED_RGB_WS2812/tests effects/a_test_train.lua | 64 ++++++++++++++ .../tests effects}/just_test_3x.lua | 0 .../tests effects}/just_test_6x.lua | 0 .../tests effects/wip/a_test_fill.lua | 79 ++++++++++++++++++ .../tests effects/wip/blink_led2.lua | 17 ++++ LED_RGB_WS2812/tests effects/wip/boot.lua | 32 +++++++ .../tests effects/wip}/cat.lua | 0 .../tests effects/wip}/dir.lua | 0 LED_RGB_WS2812/tests effects/wip/initz.lua | 19 +++++ LED_RGB_WS2812/tests effects/wip/repair.lua | 11 +++ .../tests effects/wip}/rm_files.lua | 0 LED_WS2812/Alex2/PoC.tar | Bin 8192 -> 0 bytes .../Alex2/PoC/dossier sans titre/initz.lua | 15 ---- LED_WS2812/Alex2/PoC/index.html | 60 ------------- LED_WS2812/Alex2/PoC/initz.lua | 23 ----- LED_WS2812/Alex2/PoC/start_boot.lua | 8 -- LED_WS2812/Alex2/PoC/webleds.lua | 63 -------------- LED_WS2812/Alex2/PoC/wifiap.lua | 18 ---- 32 files changed, 224 insertions(+), 189 deletions(-) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC.tar (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/cat.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/dir.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/dossier sans titre/initz.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/index.html (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/initz.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/just_test_3x.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/just_test_6x.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/rm_files.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/start_boot.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/webleds.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/Alex/PoC/wifiap.lua (100%) rename {LED_WS2812 => LED_RGB_WS2812}/WS2813_18031509433725.pdf (100%) create mode 100644 LED_RGB_WS2812/tests effects/a_test_train.lua rename {LED_WS2812/Alex2/PoC => LED_RGB_WS2812/tests effects}/just_test_3x.lua (100%) rename {LED_WS2812/Alex2/PoC => LED_RGB_WS2812/tests effects}/just_test_6x.lua (100%) create mode 100644 LED_RGB_WS2812/tests effects/wip/a_test_fill.lua create mode 100644 LED_RGB_WS2812/tests effects/wip/blink_led2.lua create mode 100644 LED_RGB_WS2812/tests effects/wip/boot.lua rename {LED_WS2812/Alex2/PoC => LED_RGB_WS2812/tests effects/wip}/cat.lua (100%) rename {LED_WS2812/Alex2/PoC => LED_RGB_WS2812/tests effects/wip}/dir.lua (100%) create mode 100644 LED_RGB_WS2812/tests effects/wip/initz.lua create mode 100644 LED_RGB_WS2812/tests effects/wip/repair.lua rename {LED_WS2812/Alex2/PoC => LED_RGB_WS2812/tests effects/wip}/rm_files.lua (100%) delete mode 100644 LED_WS2812/Alex2/PoC.tar delete mode 100644 LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua delete mode 100644 LED_WS2812/Alex2/PoC/index.html delete mode 100644 LED_WS2812/Alex2/PoC/initz.lua delete mode 100644 LED_WS2812/Alex2/PoC/start_boot.lua delete mode 100644 LED_WS2812/Alex2/PoC/webleds.lua delete mode 100644 LED_WS2812/Alex2/PoC/wifiap.lua diff --git a/Boot init.lua/mini/test webide/repair.lua b/Boot init.lua/mini/test webide/repair.lua index e1a54d7..b33274e 100644 --- a/Boot init.lua/mini/test webide/repair.lua +++ b/Boot init.lua/mini/test webide/repair.lua @@ -1,12 +1,12 @@ -- Scripts de seconde chance pour réparer une boucle dans le restart -print("\n repair.lua zf181119.1511 \n") +print("\n repair.lua zf181120.1012 \n") --if file.exists("wifi_ap_start.lua") then dofile("wifi_ap_start.lua") end if file.exists("wifi_ap_stop.lua") then dofile("wifi_ap_stop.lua") end if file.exists("wifi_cli_conf.lua") then dofile("wifi_cli_conf.lua") end if file.exists("wifi_cli_start.lua") then dofile("wifi_cli_start.lua") end -if file.exists("ide2.lua") then dofile("ide2.lua") end +if file.exists("ide.lua") then dofile("ide.lua") end if file.exists("telnet_srv.lua") then dofile("telnet_srv.lua") end jobtimer1=tmr.create() diff --git a/LED_WS2812/Alex/PoC.tar b/LED_RGB_WS2812/Alex/PoC.tar similarity index 100% rename from LED_WS2812/Alex/PoC.tar rename to LED_RGB_WS2812/Alex/PoC.tar diff --git a/LED_WS2812/Alex/PoC/cat.lua b/LED_RGB_WS2812/Alex/PoC/cat.lua similarity index 100% rename from LED_WS2812/Alex/PoC/cat.lua rename to LED_RGB_WS2812/Alex/PoC/cat.lua diff --git a/LED_WS2812/Alex/PoC/dir.lua b/LED_RGB_WS2812/Alex/PoC/dir.lua similarity index 100% rename from LED_WS2812/Alex/PoC/dir.lua rename to LED_RGB_WS2812/Alex/PoC/dir.lua diff --git a/LED_WS2812/Alex/PoC/dossier sans titre/initz.lua b/LED_RGB_WS2812/Alex/PoC/dossier sans titre/initz.lua similarity index 100% rename from LED_WS2812/Alex/PoC/dossier sans titre/initz.lua rename to LED_RGB_WS2812/Alex/PoC/dossier sans titre/initz.lua diff --git a/LED_WS2812/Alex/PoC/index.html b/LED_RGB_WS2812/Alex/PoC/index.html similarity index 100% rename from LED_WS2812/Alex/PoC/index.html rename to LED_RGB_WS2812/Alex/PoC/index.html diff --git a/LED_WS2812/Alex/PoC/initz.lua b/LED_RGB_WS2812/Alex/PoC/initz.lua similarity index 100% rename from LED_WS2812/Alex/PoC/initz.lua rename to LED_RGB_WS2812/Alex/PoC/initz.lua diff --git a/LED_WS2812/Alex/PoC/just_test_3x.lua b/LED_RGB_WS2812/Alex/PoC/just_test_3x.lua similarity index 100% rename from LED_WS2812/Alex/PoC/just_test_3x.lua rename to LED_RGB_WS2812/Alex/PoC/just_test_3x.lua diff --git a/LED_WS2812/Alex/PoC/just_test_6x.lua b/LED_RGB_WS2812/Alex/PoC/just_test_6x.lua similarity index 100% rename from LED_WS2812/Alex/PoC/just_test_6x.lua rename to LED_RGB_WS2812/Alex/PoC/just_test_6x.lua diff --git a/LED_WS2812/Alex/PoC/rm_files.lua b/LED_RGB_WS2812/Alex/PoC/rm_files.lua similarity index 100% rename from LED_WS2812/Alex/PoC/rm_files.lua rename to LED_RGB_WS2812/Alex/PoC/rm_files.lua diff --git a/LED_WS2812/Alex/PoC/start_boot.lua b/LED_RGB_WS2812/Alex/PoC/start_boot.lua similarity index 100% rename from LED_WS2812/Alex/PoC/start_boot.lua rename to LED_RGB_WS2812/Alex/PoC/start_boot.lua diff --git a/LED_WS2812/Alex/PoC/webleds.lua b/LED_RGB_WS2812/Alex/PoC/webleds.lua similarity index 100% rename from LED_WS2812/Alex/PoC/webleds.lua rename to LED_RGB_WS2812/Alex/PoC/webleds.lua diff --git a/LED_WS2812/Alex/PoC/wifiap.lua b/LED_RGB_WS2812/Alex/PoC/wifiap.lua similarity index 100% rename from LED_WS2812/Alex/PoC/wifiap.lua rename to LED_RGB_WS2812/Alex/PoC/wifiap.lua diff --git a/LED_WS2812/WS2813_18031509433725.pdf b/LED_RGB_WS2812/WS2813_18031509433725.pdf similarity index 100% rename from LED_WS2812/WS2813_18031509433725.pdf rename to LED_RGB_WS2812/WS2813_18031509433725.pdf diff --git a/LED_RGB_WS2812/tests effects/a_test_train.lua b/LED_RGB_WS2812/tests effects/a_test_train.lua new file mode 100644 index 0000000..6d56445 --- /dev/null +++ b/LED_RGB_WS2812/tests effects/a_test_train.lua @@ -0,0 +1,64 @@ +-- Scripts juste pour tester des effets à la mano +-- tout sur la couleur: https://www.w3schools.com/colors/default.asp +-- roue des couleurs: https://iro.js.org/?ref=oldsite + +print("\n a_tst_train.lua zf181125.1258 \n") + +print("Initializing LED strip...") +ws2812.init() +buffer = ws2812.newBuffer(30, 3) +buffer:fill(0, 0, 0) +ws2812.write(buffer) +print("done.") +print() + + + +--[[ + +print("toto") + +ws2812.init() +strip_buffer = ws2812.newBuffer(300, 3) +ws2812_effects.init(strip_buffer) +-- initially all leds off +ws2812_effects.set_speed(255) +ws2812_effects.set_brightness(0) +ws2812_effects.set_color(0,0,0) +ws2812_effects.start() +print("done.") +print() + +ws2812.init() + +local i, buffer = 0, ws2812.newBuffer(300, 3) +buffer:fill(0, 0, 0, 0) + +exit + + +ws2812.init() +j=1 +local i, buffer = 0, ws2812.newBuffer(300, 3); buffer:fill(0, 0, 0, 0); tmr.create():alarm(20, 1, function() + i = i + j + buffer:fade(2) + buffer:set(i % buffer:size() + 1, 255, 255, 255) + ws2812.write(buffer) + if i>=buffer:size()-1 or i<=0 then + j=j*-1 + end +end) + + + + +ws2812.write(string.char(255, 0, 0, 0, 255, 0, 0, 0, 255)) -- RGB positionnement naturel + +ws2812.write(string.char(0, 255, 0, 0, 0, 255, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- GBR and CMY en GBR WS2813! + +ws2812.write(string.char(0, 255, 0, 0, 0, 255/3, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- vert compensé GBR and CMY en GBR WS2813! + +ws2812.write(string.char(128, 255, 128, 200, 200, 255, 255, 200, 200, 255, 255, 255, 40, 40, 40, 5, 5, 5)) -- White RGB & White 100/50/10% + +ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) -- LED OFF +]] diff --git a/LED_WS2812/Alex2/PoC/just_test_3x.lua b/LED_RGB_WS2812/tests effects/just_test_3x.lua similarity index 100% rename from LED_WS2812/Alex2/PoC/just_test_3x.lua rename to LED_RGB_WS2812/tests effects/just_test_3x.lua diff --git a/LED_WS2812/Alex2/PoC/just_test_6x.lua b/LED_RGB_WS2812/tests effects/just_test_6x.lua similarity index 100% rename from LED_WS2812/Alex2/PoC/just_test_6x.lua rename to LED_RGB_WS2812/tests effects/just_test_6x.lua diff --git a/LED_RGB_WS2812/tests effects/wip/a_test_fill.lua b/LED_RGB_WS2812/tests effects/wip/a_test_fill.lua new file mode 100644 index 0000000..f9c1804 --- /dev/null +++ b/LED_RGB_WS2812/tests effects/wip/a_test_fill.lua @@ -0,0 +1,79 @@ +-- Scripts juste pour tester des effets à la mano +-- tout sur la couleur: https://www.w3schools.com/colors/default.asp +-- roue des couleurs: https://iro.js.org/?ref=oldsite + +print("\n a_tst_train.lua zf181125.1258 \n") + +znbled=300 + +function RGB_clear() + ws2812.init() + buffer = ws2812.newBuffer(znbled, 3) + buffer:fill(0, 0, 0) + ws2812.write(buffer) +end + +print("Initializing LED strip...") +RGB_clear() +print("done.") + + +znbled_tst=10 +zlumino=1 --luminosité 0 <> 1 +zR=255*zlumino +zG=255*zlumino +zB=255*zlumino +buffer = ws2812.newBuffer(znbled_tst, 3) +buffer:fill(0, 0, 255) -- Green, Red , Blue +ws2812.write(buffer) + + + +--[[ + +print("toto") + +ws2812.init() +strip_buffer = ws2812.newBuffer(300, 3) +ws2812_effects.init(strip_buffer) +-- initially all leds off +ws2812_effects.set_speed(255) +ws2812_effects.set_brightness(0) +ws2812_effects.set_color(0,0,0) +ws2812_effects.start() +print("done.") +print() + +ws2812.init() + +local i, buffer = 0, ws2812.newBuffer(300, 3) +buffer:fill(0, 0, 0, 0) + +exit + + +ws2812.init() +j=1 +local i, buffer = 0, ws2812.newBuffer(300, 3); buffer:fill(0, 0, 0, 0); tmr.create():alarm(20, 1, function() + i = i + j + buffer:fade(2) + buffer:set(i % buffer:size() + 1, 255, 255, 255) + ws2812.write(buffer) + if i>=buffer:size()-1 or i<=0 then + j=j*-1 + end +end) + + + + +ws2812.write(string.char(255, 0, 0, 0, 255, 0, 0, 0, 255)) -- RGB positionnement naturel + +ws2812.write(string.char(0, 255, 0, 0, 0, 255, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- GBR and CMY en GBR WS2813! + +ws2812.write(string.char(0, 255, 0, 0, 0, 255/3, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- vert compensé GBR and CMY en GBR WS2813! + +ws2812.write(string.char(128, 255, 128, 200, 200, 255, 255, 200, 200, 255, 255, 255, 40, 40, 40, 5, 5, 5)) -- White RGB & White 100/50/10% + +ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) -- LED OFF +]] diff --git a/LED_RGB_WS2812/tests effects/wip/blink_led2.lua b/LED_RGB_WS2812/tests effects/wip/blink_led2.lua new file mode 100644 index 0000000..70fa251 --- /dev/null +++ b/LED_RGB_WS2812/tests effects/wip/blink_led2.lua @@ -0,0 +1,17 @@ +-- programme pour faire clignoter une LED version simplifiée + +print("\n blink_led2.lua zf181015.1138 \n") + +zLED=0 +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +value = true + +tmr.alarm(ztmr_LED, 100, tmr.ALARM_AUTO, function () + if value then + gpio.write(zLED, gpio.HIGH) + else + gpio.write(zLED, gpio.LOW) + end + value = not value +end) diff --git a/LED_RGB_WS2812/tests effects/wip/boot.lua b/LED_RGB_WS2812/tests effects/wip/boot.lua new file mode 100644 index 0000000..6aeec7b --- /dev/null +++ b/LED_RGB_WS2812/tests effects/wip/boot.lua @@ -0,0 +1,32 @@ +-- Scripts à charger après le boot pour démarrer son appli + +print("\n boot.lua zf181125.1234 \n") + +--f= "wifi_ap_stop.lua" if file.exists(f) then dofile(f) end +--f= "wifi_cli_conf.lua" if file.exists(f) then dofile(f) end +--f= "wifi_cli_start.lua" if file.exists(f) then dofile(f) end +--f= "telnet_srv.lua" if file.exists(f) then dofile(f) end +--f= "web_ide2.lua" if file.exists(f) then dofile(f) end +--f= "dsleep.lua" if file.exists(f) then dofile(f) end + +--f= "test_train.lua" if file.exists(f) then dofile(f) end + + + + +--[[ +x_dsleep=7 y_dsleep=30 dsleep() + +i=1 +jobtimer1=tmr.create() +tmr.alarm(jobtimer1, 1*1000, tmr.ALARM_AUTO, function() + print(i) i=i+1 + if wifi.sta.getip() ~= nil then + tmr.stop(jobtimer1) + tmr.stop(ztmr_SLEEP) + x_dsleep=300 y_dsleep=30 dsleep() + print("c'est connecté...") + end +end) +]] + diff --git a/LED_WS2812/Alex2/PoC/cat.lua b/LED_RGB_WS2812/tests effects/wip/cat.lua similarity index 100% rename from LED_WS2812/Alex2/PoC/cat.lua rename to LED_RGB_WS2812/tests effects/wip/cat.lua diff --git a/LED_WS2812/Alex2/PoC/dir.lua b/LED_RGB_WS2812/tests effects/wip/dir.lua similarity index 100% rename from LED_WS2812/Alex2/PoC/dir.lua rename to LED_RGB_WS2812/tests effects/wip/dir.lua diff --git a/LED_RGB_WS2812/tests effects/wip/initz.lua b/LED_RGB_WS2812/tests effects/wip/initz.lua new file mode 100644 index 0000000..a9171d9 --- /dev/null +++ b/LED_RGB_WS2812/tests effects/wip/initz.lua @@ -0,0 +1,19 @@ +--Script de bootstrap, test au moment du boot qui a été la cause de boot. +-- Si la cause est un power on ou une connexion depuis l'IDE, alors +-- le script repair.lua pendant 30 secondes avant de continuer +--Source: https://nodemcu.readthedocs.io/en/master/en/modules/node/#nodebootreason + +print("\n init.lua zf181120.0002 \n") + +_, reset_reason = node.bootreason() +print("reset_reason:",reset_reason) +if reset_reason == 6 or reset_reason == 6 then + print("seconde chance...") + f= "repair.lua" if file.exists(f) then dofile(f) end + initalarme=tmr.create() + tmr.alarm(initalarme, 30*1000, tmr.ALARM_SINGLE, function() + f= "boot.lua" if file.exists(f) then dofile(f) end + end) +else + f= "boot.lua" if file.exists(f) then dofile(f) end +end diff --git a/LED_RGB_WS2812/tests effects/wip/repair.lua b/LED_RGB_WS2812/tests effects/wip/repair.lua new file mode 100644 index 0000000..400e952 --- /dev/null +++ b/LED_RGB_WS2812/tests effects/wip/repair.lua @@ -0,0 +1,11 @@ +-- Scripts de seconde chance pour réparer une boucle dans le restart + +print("\n repair.lua zf181119.2356 \n") + +f= "wifi_ap_start.lua" if file.exists(f) then dofile(f) end +f= "telnet_srv.lua" if file.exists(f) then dofile(f) end + +jobtimer1=tmr.create() +tmr.alarm(jobtimer1, 5*1000, tmr.ALARM_AUTO, function() + print("repair...") +end) diff --git a/LED_WS2812/Alex2/PoC/rm_files.lua b/LED_RGB_WS2812/tests effects/wip/rm_files.lua similarity index 100% rename from LED_WS2812/Alex2/PoC/rm_files.lua rename to LED_RGB_WS2812/tests effects/wip/rm_files.lua diff --git a/LED_WS2812/Alex2/PoC.tar b/LED_WS2812/Alex2/PoC.tar deleted file mode 100644 index c782384b41db659b6ab6a8bae4d874e1d81e07cd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8192 zcmeGg{cqd0GC%9Dxar{~a%)Sn9LIgG?XAhWtiXT;O|XZzzQK?s$|fRF8cEx6i|%jV z9Vxj^(>2M^3K^rbAqHd6 z>tX!=l9)VH{Ljjhhx6!{<2?H6+aFIZ{&)5g=nPDpQM0f(#V5^m&L%&+{1(o&$3l1Mbb@>{rARwTnU``1|4Pm0x%1v} z7TpgzSi&9=8c_5xC_1b`!4uF6uAqo@vS11hBx)t%14y~5@_3`*N#J}_u$0H363Li= zSft=})@*jkb*JE>ld=_0Sf}DwEbquz^KuAL%ZS{%rgn~1%t{A%k4DvMUxObR?P|Ey z{Tlr68EH>&w0jiPaTo;)8#oe*VHqvDCVChJj9y}+2UR?0h}ks=(d1-NmWrWGz_N@b zdWf(HgTJKnkn_nXhJ|F=*bTl`Oph(nzFo#L=3-W^r^zPCnLBxHAK`=^M?pLp1<2uc zHhC;nDW)okg<#U1{9vBp+&ap_KuX}Jek!ez2l)1)kBSVor0 zot&5*Op|(Nhgm@G#DGMTGoD;RjM1R;`*~j*oP9Zt`u+X+INYC&L-a9Aclh26P(u_V z2@x8iQ#!YICL>8mN-kM`-jR(ktDzNVDF3_Q`fjA8XKmVXj`_W#W$m=U9%uBGDN@dt ztAGD=PF!&9=gasZ{cubF4}0OD?*CC3_Gtb)8Vth6{{N6MX?Q!85k8b@MWbbI5qk)DWThn11>>SHvkRC0w>w$N?J-m&(gqke1l0z{xHyiltBrybI_`4TE6L^gnX)2THfsmx ztYRHY7R>T;78J44Oa_>ZQ+5>>6&8j7k5*hwbvd8sY+7+aZN_m>ps6vi<{5`1=S*n8 zit*wM3KW6xZHgm;g%c%a`7R)?>P=!u_YNHt<dv6bas4grYr#=!VfD z%r=^-ubhUZVK+6^+eWo*IE%PoEo=@vGmm~*G2syw0ove7w?)zf^$(D&VzD+q0c;Z@ z!M6S2Ju~$V{x9&P5Uycq)Y_8Mrj|%_ayWq z0AbS~xe3oX+9p>_I!dn4dcm}h*Th(}bF=Ny#>L4Qo-DZF}o5PXV>bV zzPvyl@8~LQr5ojcyD8g_7GP$J+OoO1wR=QChW&f}v^DnL#GSWc=RZ?4asLS(AUl2# zcbKBEHTTcQD9&78hIHt$?0FHyEJv9W?u`FdSB`0!TK z6az#cownJ96#80fwICVR$xY5NgXuqGs-!M#d+DE_A#S6*W&R8MQ8WK_!yf*o_rG{0 ze4PJobLFb=z4-S|0n1`K)B+s$J(yP?^MXSmAS7#8Xsq`IPNI%B+f(1@B zI8lW3z0(g(mBCuw=!Lv^<+bXTwcD}mwbMPVYc;CCMONC$kE&s=SY0zM=E1A8AsnGu(o5;GqCu=Krlw|mxXFHjxID6W^uVJB9zF2T9{3%rSeJqT diff --git a/LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua b/LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua deleted file mode 100644 index 17beb40..0000000 --- a/LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua +++ /dev/null @@ -1,15 +0,0 @@ - -print() -print("starting init.lua...") -print() -print("local files:") -l=file.list() -for k,v in pairs(l) do - print(k.." "..v) -end -print() - -print("starting webleds...") -print() -dofile('webleds.lua') - diff --git a/LED_WS2812/Alex2/PoC/index.html b/LED_WS2812/Alex2/PoC/index.html deleted file mode 100644 index 62283da..0000000 --- a/LED_WS2812/Alex2/PoC/index.html +++ /dev/null @@ -1,60 +0,0 @@ - - - -LED Strip Control - - - - -

LED strip control page

- -

Choose an effect:

- - -

Pick a color:

- - - - - diff --git a/LED_WS2812/Alex2/PoC/initz.lua b/LED_WS2812/Alex2/PoC/initz.lua deleted file mode 100644 index 97951ca..0000000 --- a/LED_WS2812/Alex2/PoC/initz.lua +++ /dev/null @@ -1,23 +0,0 @@ ---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/LED_WS2812/Alex2/PoC/start_boot.lua b/LED_WS2812/Alex2/PoC/start_boot.lua deleted file mode 100644 index c651d1d..0000000 --- a/LED_WS2812/Alex2/PoC/start_boot.lua +++ /dev/null @@ -1,8 +0,0 @@ --- Scripts à charger au moment du boot - -print("\n start_boot.lua zf181105.1122 \n") - -print("starting webleds...") -print() -dofile('webleds.lua') - diff --git a/LED_WS2812/Alex2/PoC/webleds.lua b/LED_WS2812/Alex2/PoC/webleds.lua deleted file mode 100644 index 81bd992..0000000 --- a/LED_WS2812/Alex2/PoC/webleds.lua +++ /dev/null @@ -1,63 +0,0 @@ --- initially based on https://github.com/nodemcu/nodemcu-firmware/blob/master/lua_examples/webap_toggle_pin.lua - --- start wifi client or AP mode ---dofile('wificlient.lua') -dofile('wifiap.lua') - --- LED init (strip with 72 leds) -print("Initializing LED strip...") -ws2812.init() -strip_buffer = ws2812.newBuffer(6, 3) -ws2812_effects.init(strip_buffer) --- initially all leds off -ws2812_effects.set_speed(200) -ws2812_effects.set_brightness(0) -ws2812_effects.set_color(0,0,0) -ws2812_effects.start() -print("done.") -print() - --- helper functions --- send a file from memory to the client; max. line length = 1024 bytes! -function send_file(client, filename) - if file.open(filename, "r") then - repeat - local line=file.read('\n') - if line then - client:send(line) - end - until not line - file.close() - end -end - --- web server -srv = net.createServer(net.TCP) -srv:listen(80, function(conn) - conn:on("receive", function(client, request) - local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") - if (method == nil) then - _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP") - end - local _GET = {} - if (vars ~= nil) then - for k, v in string.gmatch(vars, "(%w+)=([a-z0-9_]+)&*") do - _GET[k] = v - end - end - if (_GET.set == "effect") then - print("setting effect", _GET.effect) - ws2812_effects.set_mode(_GET.effect) - ws2812_effects.set_speed(200) - ws2812_effects.set_brightness(50) - ws2812_effects.start() - end - if (_GET.set == "color") then - print("setting color (RGB)", _GET.r, _GET.g, _GET.b) - ws2812_effects.set_color(_GET.g, _GET.r, _GET.b) -- obviously our strip is GRB and not RGB - end - send_file(client, 'index.html') - end) - conn:on("sent", function(c) c:close() end) -end) - diff --git a/LED_WS2812/Alex2/PoC/wifiap.lua b/LED_WS2812/Alex2/PoC/wifiap.lua deleted file mode 100644 index 13f559a..0000000 --- a/LED_WS2812/Alex2/PoC/wifiap.lua +++ /dev/null @@ -1,18 +0,0 @@ - --- set AP mode -wifi.setmode(wifi.SOFTAP) -wifi.ap.config({ ssid = "webleds", pwd = "12345678" }) -print("Started AP mode") - --- get and display our IP addr. -tmr.alarm(0, 1000, 1, function() - if wifi.ap.getip() == nil then - print("Getting AP info...") - else - print('IP: ', wifi.ap.getip()) - tmr.stop(0) - end -end) - -print() -