diff --git a/.gitignore b/.gitignore index 5abb575..27dbd3d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +Icon? Tools* .DS_Store diff --git a/Hugo/README.md b/Hugo/README.md old mode 100755 new mode 100644 diff --git a/Hugo/init.lua b/Hugo/init.lua old mode 100755 new mode 100644 diff --git a/Hugo/led_blink_1.lua b/Hugo/led_blink_1.lua old mode 100755 new mode 100644 diff --git a/Hugo/led_blink_2.lua b/Hugo/led_blink_2.lua old mode 100755 new mode 100644 diff --git a/Hugo/led_intensite.lua b/Hugo/led_intensite.lua old mode 100755 new mode 100644 diff --git a/Hugo/led_intensite_variable.lua b/Hugo/led_intensite_variable.lua old mode 100755 new mode 100644 diff --git a/Hugo/led_press_button.lua b/Hugo/led_press_button.lua old mode 100755 new mode 100644 diff --git a/Hugo/luatool.py b/Hugo/luatool.py old mode 100755 new mode 100644 diff --git a/Hugo/meter_mesure.lua b/Hugo/meter_mesure.lua old mode 100755 new mode 100644 diff --git a/Hugo/oled_first.lua b/Hugo/oled_first.lua old mode 100755 new mode 100644 diff --git a/Hugo/robot_avance_arrete.lua b/Hugo/robot_avance_arrete.lua old mode 100755 new mode 100644 diff --git a/Hugo/robot_mesure_turn_right.lua b/Hugo/robot_mesure_turn_right.lua old mode 100755 new mode 100644 diff --git a/Hugo/robot_random_mesure.lua b/Hugo/robot_random_mesure.lua old mode 100755 new mode 100644 diff --git a/Hugo/start_EPSlorer.sh b/Hugo/start_EPSlorer.sh old mode 100755 new mode 100644 diff --git a/Hugo/start_screen.sh b/Hugo/start_screen.sh old mode 100755 new mode 100644 diff --git a/Hugo/test_blink_1.lua b/Hugo/test_blink_1.lua old mode 100755 new mode 100644 diff --git a/Hugo/test_blink_2.lua b/Hugo/test_blink_2.lua old mode 100755 new mode 100644 diff --git a/Hugo/test_get_ip_1.lua b/Hugo/test_get_ip_1.lua old mode 100755 new mode 100644 diff --git a/Hugo/test_init_1.lua b/Hugo/test_init_1.lua old mode 100755 new mode 100644 diff --git a/Hugo/test_press_button_1.lua b/Hugo/test_press_button_1.lua old mode 100755 new mode 100644 diff --git a/Hugo/test_web_1.lua b/Hugo/test_web_1.lua old mode 100755 new mode 100644 diff --git a/Hugo/u_dir.lua b/Hugo/u_dir.lua old mode 100755 new mode 100644 diff --git a/Hugo/u_get_ip.lua b/Hugo/u_get_ip.lua old mode 100755 new mode 100644 diff --git a/Hugo/u_start_job.lua b/Hugo/u_start_job.lua old mode 100755 new mode 100644 diff --git a/Hugo/u_telnet_srv.lua b/Hugo/u_telnet_srv.lua old mode 100755 new mode 100644 diff --git a/Hugo/u_web_stop.lua b/Hugo/u_web_stop.lua old mode 100755 new mode 100644 diff --git a/Hugo/web_liste_deroulante_led_change.lua b/Hugo/web_liste_deroulante_led_change.lua old mode 100755 new mode 100644 diff --git a/Hugo/web_oled_decode_url.lua b/Hugo/web_oled_decode_url.lua old mode 100755 new mode 100644 diff --git a/Hugo/web_press_button_led.lua b/Hugo/web_press_button_led.lua old mode 100755 new mode 100644 diff --git a/Hugo/web_robot_on_off.lua b/Hugo/web_robot_on_off.lua old mode 100755 new mode 100644 diff --git a/Trigo/test_trigo1.lua b/Trigo/test_trigo1.lua index 2f879e0..5695323 100644 --- a/Trigo/test_trigo1.lua +++ b/Trigo/test_trigo1.lua @@ -1,24 +1,49 @@ -- tests des routines trigonométriques pour NodeMCU -print("\ntest_trigo1.lua zf180820.2209 \n") +print("\ntest_trigo1.lua zf1808201.1758 \n") -- chargement des routines trigonométriques dofile("trigo3.lua") -for i = 0, 2*math.pi, 2*math.pi/32 do +for i = 0, 4*math.pi, 4*math.pi/64 do a=i --- b=math.tan(a) --- print("arctangente: "..a..", "..b..", "..math.atan(b)..", "..zatan(b)..", "..math.atan(b)/zatan(b)) + b=math.tan(a) + print("arctangente: "..a..", "..b..", "..math.atan(b)..", "..zatan(b)..", "..math.atan(b)/zatan(b)) + -- print("sinus: "..a..", "..math.sin(a)..", "..zsin(a)..", "..math.sin(a)/zsin(a)) -- print("cosinus: "..a..", "..math.cos(a)..", "..zcos(a)..", "..math.cos(a)/zcos(a)) -- print("tangente: "..a..", "..math.tan(a)..", "..ztan(a)..", "..math.tan(a)/ztan(a)) --- b=math.sin(a) + b=math.sin(a) -- print("arcsinus: "..a..", "..b..", "..math.asin(b)..", "..zasin(b)..", "..math.asin(b)/zasin(b)) + b=math.cos(a) - print("arccosinus: "..a..", "..b..", "..math.acos(b)..", "..zacos(b)..", "..math.acos(b)/zacos(b)) +-- print("arccosinus: "..a..", "..b..", "..math.acos(b)..", "..zacos(b)..", "..math.acos(b)/zacos(b)) + end print("\n") -x=-0.70710678118655 -print(math.acos(x)) -print(zatan(math.sqrt(1-x*x)/x)) -print(math.sqrt(1-x*x)/x) +y=2.5525440310417 +print("y: "..y) +x=math.cos(y) +print("x: "..x) +print("math.acos: "..math.acos(x)) +z=math.sqrt(1-x*x)/x +print("z: "..z) +print("zatan: "..zatan(z)) + + + + + + + + + + + + + + + + + +-- diff --git a/Trigo/trigo3.lua b/Trigo/trigo3.lua index 691ce4f..10247ec 100644 --- a/Trigo/trigo3.lua +++ b/Trigo/trigo3.lua @@ -5,7 +5,7 @@ print("\ntrigo3.lua zf180820.2205 \n") -Gros problème encore avec les atan négatives et du coup avec les acos, zf180820.2252 +-- encore des problèmes, 8% d'erreur, avec les atan vers pi/4, zf180821.1849 function zsin(x) @@ -33,7 +33,9 @@ function zasin(x) end function zacos(x) - return zatan(math.sqrt(1-x*x)/x) +-- return zatan(math.sqrt(1-x*x)/x) +--return math.pi/2-zatan(x/math.sqrt(1-x*x)) +return math.pi/2-zasin(x) end diff --git a/Wifi/wifi_ap_start.lua b/Wifi/wifi_ap_start.lua new file mode 100644 index 0000000..f87996f --- /dev/null +++ b/Wifi/wifi_ap_start.lua @@ -0,0 +1,22 @@ +-- Démarre le WIFI en mode AP +print("\wifi_ap_start.lua zf180822.1447 \n") + +function zap_start() + wifi.ap.config({ ssid = "NodeMCU "..wifi.ap.getmac(), pwd = "12345678" }) +end + +local zmodewifi=wifi.getmode() +if zmodewifi == wifi.NULLMODE then + print("WIFI mode AP only") + wifi.setmode(wifi.SOFTAP) + zap_start() +elseif zmodewifi == wifi.STATION then + print("WIFI mode AP+CLI") + wifi.setmode(wifi.STATIONAP) + zap_start() +else + print("on ne fait rien car cela tourne déjà !") +end +dofile("wifi_info.lua") + + diff --git a/Wifi/wifi_ap_stop.lua b/Wifi/wifi_ap_stop.lua new file mode 100644 index 0000000..c89dd2c --- /dev/null +++ b/Wifi/wifi_ap_stop.lua @@ -0,0 +1,26 @@ +-- Démarre le WIFI en mode AP +print("\wifi_ap_stop.lua zf180822.1425 \n") + +local zmodewifi=wifi.getmode() +if zmodewifi == wifi.SOFTAP then + wifi.setmode(wifi.NULLMODE) +elseif zmodewifi == wifi.STATIONAP then + wifi.setmode(wifi.STATION) +end +print("WIFI AP arrêté") + + + + +--[[ +wifi.setmode(wifi.NULLMODE) +print(wifi.ap.getconfig()) +print(wifi.ap.getmac()) +print(wifi.getdefaultmode()) + +print(wifi.getmode()) +print(wifi.NULLMODE, wifi.STATION, wifi.SOFTAP, wifi.STATIONAP) + +print(wifi.getphymode()) +print(wifi.PHYMODE_B, wifi.PHYMODE_G, wifi.PHYMODE_N) +]] diff --git a/Wifi/wifi_cli_conf.lua b/Wifi/wifi_cli_conf.lua new file mode 100644 index 0000000..6dad55c --- /dev/null +++ b/Wifi/wifi_cli_conf.lua @@ -0,0 +1,4 @@ +-- Petit script pour configurer le client WIFI du NodeMCU +print("\wifi_cli_conf.lua zf180822.1407 \n") + +wifi.sta.config{ssid="Hugo", pwd="tototutu", save=true} diff --git a/Wifi/wifi_cli_start.lua b/Wifi/wifi_cli_start.lua new file mode 100644 index 0000000..0419120 --- /dev/null +++ b/Wifi/wifi_cli_start.lua @@ -0,0 +1,17 @@ +-- Petit script pour connecter le NodeMCU sur un AP Wifi avec l'accompte sauvé en EEPROM +print("\wifi_clidef_start.lua zf180822.1412 \n") + +local zmodewifi=wifi.getmode() +if zmodewifi == wifi.NULLMODE then + print("WIFI mode CLI only") + wifi.setmode(wifi.STATION) +elseif zmodewifi == wifi.SOFTAP then + print("WIFI mode AP+CLI") + wifi.setmode(wifi.STATIONAP) +else + print("on ne fait rien car cela tourne déjà !") +end +wifi.sta.connect() +dofile("wifi_get_ip.lua") + + diff --git a/Wifi/wifi_cli_stop.lua b/Wifi/wifi_cli_stop.lua new file mode 100644 index 0000000..11af8c0 --- /dev/null +++ b/Wifi/wifi_cli_stop.lua @@ -0,0 +1,26 @@ +-- Démarre le WIFI en mode AP +print("\wifi_ap_stop.lua zf180822.1425 \n") + +local zmodewifi=wifi.getmode() +if zmodewifi == wifi.STATIONAP then + wifi.setmode(wifi.NULLMODE) +elseif zmodewifi == wifi.SOFTAP then + wifi.setmode(wifi.STATION) +end +print("WIFI AP arrêté") + + + + +--[[ +wifi.setmode(wifi.NULLMODE) +print(wifi.ap.getconfig()) +print(wifi.ap.getmac()) +print(wifi.getdefaultmode()) + +print(wifi.getmode()) +print(wifi.NULLMODE, wifi.STATION, wifi.SOFTAP, wifi.STATIONAP) + +print(wifi.getphymode()) +print(wifi.PHYMODE_B, wifi.PHYMODE_G, wifi.PHYMODE_N) +]] diff --git a/Wifi/wifi_get_ip.lua b/Wifi/wifi_get_ip.lua new file mode 100644 index 0000000..65f140b --- /dev/null +++ b/Wifi/wifi_get_ip.lua @@ -0,0 +1,17 @@ +-- Petit script pour obtenir l'adresse IP du NodeMCU connecté sur un AP Wifi +print("\wifi_get_ip.lua zf180822.1422 \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) + 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("Connected IP:\n\t"..wifi.sta.getip()) + end +end) + diff --git a/Wifi/wifi_info.lua b/Wifi/wifi_info.lua new file mode 100644 index 0000000..aa8b24a --- /dev/null +++ b/Wifi/wifi_info.lua @@ -0,0 +1,44 @@ +-- Petit script pour afficher les infos actuel du WIFI +print("\wifi_info.lua zf180822.1452 \n") + +local zmodewifi=wifi.getmode() + +--wifi.NULLMODE, wifi.STATION, wifi.SOFTAP, wifi.STATIONAP + +if zmodewifi == wifi.NULLMODE then + print("WIFI OFF") +elseif zmodewifi == wifi.STATION then + print("WIFI mode CLI") + print("Client IP:\n\t"..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("Client IP:\n\t"..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 + + +--[[ +wifi.setmode(wifi.NULLMODE) +print(wifi.ap.getconfig()) +print(wifi.ap.getmac()) +print(wifi.getdefaultmode()) + +print(wifi.getmode()) +print(wifi.NULLMODE, wifi.STATION, wifi.SOFTAP, wifi.STATIONAP) + +print(wifi.getphymode()) +print(wifi.PHYMODE_B, wifi.PHYMODE_G, wifi.PHYMODE_N) +]] diff --git a/Wifi/wifi_off.lua b/Wifi/wifi_off.lua new file mode 100644 index 0000000..ddd3b81 --- /dev/null +++ b/Wifi/wifi_off.lua @@ -0,0 +1,11 @@ +-- Déconnecte le WIFI + +print("\wifi_off.lua zf180822.0959 \n") + +wifi.setmode(wifi.NULLMODE) + +--[[ +print(wifi.NULLMODE, wifi.STATION, wifi.SOFTAP, wifi.STATIONAP) +print(wifi.getmode()) +]] + diff --git a/wificnf_start.lua b/Wifi/wificnf_start.lua similarity index 100% rename from wificnf_start.lua rename to Wifi/wificnf_start.lua diff --git a/wificnf_stop.lua b/Wifi/wificnf_stop.lua similarity index 100% rename from wificnf_stop.lua rename to Wifi/wificnf_stop.lua diff --git a/oled_demo_minid1.lua b/oled_demo_minid1.lua old mode 100755 new mode 100644 diff --git a/oled_first_minid1.lua b/oled_first_minid1.lua old mode 100755 new mode 100644 diff --git a/Wifi_led_onoff.lua b/web_led_onoff.lua similarity index 100% rename from Wifi_led_onoff.lua rename to web_led_onoff.lua diff --git a/web_oled_minid1.lua b/web_oled_minid1.lua old mode 100755 new mode 100644 diff --git a/wifi_ap_start.lua b/wifi_ap_start.lua deleted file mode 100755 index 8b046ab..0000000 --- a/wifi_ap_start.lua +++ /dev/null @@ -1,5 +0,0 @@ --- Démarre un WIFI AP -print("\wifi_ap_start.lua zf20180724.2220 \n") - -wifi.setmode(wifi.SOFTAP) -wifi.ap.config({ ssid = "NodeMCU", pwd = "12345678" }) diff --git a/wifi_off.lua b/wifi_off.lua deleted file mode 100644 index 54fcc3d..0000000 --- a/wifi_off.lua +++ /dev/null @@ -1,4 +0,0 @@ --- Déconnecte le WIFI --- zf180713.1453 - -wifi.sta.disconnect()