From 409f6dae7419c1f7cc2391669a05f4e847ce755b Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Thu, 16 Apr 2020 15:51:02 +0200 Subject: [PATCH] wip --- Mesures/ADC/ADS1115/boot.lua | 6 +-- .../btn_led_remote/btn/wifi_cli_conf.lua | 2 +- Workshop/200303/script1.lua | 16 ++++++++ Workshop/200303/script2.lua | 24 ++++++++++++ zflash-epfl.sh | 38 +++++++++++++++++++ 5 files changed, 82 insertions(+), 4 deletions(-) create mode 100644 Workshop/200303/script1.lua create mode 100644 Workshop/200303/script2.lua create mode 100644 zflash-epfl.sh diff --git a/Mesures/ADC/ADS1115/boot.lua b/Mesures/ADC/ADS1115/boot.lua index 52609f5..a58b4b0 100644 --- a/Mesures/ADC/ADS1115/boot.lua +++ b/Mesures/ADC/ADS1115/boot.lua @@ -1,6 +1,6 @@ -- Scripts à charger après le boot pour démarrer son projet -print("\n boot.lua zf200229.2303 \n") +print("\n boot.lua zf200303.1409 \n") function boot() verbose = true @@ -11,10 +11,10 @@ function boot() --zurl=thingspeak_url.."field1="..tostring(ztemp1).."&field2="..tostring(zhum1) --f="0_send_data.lua" if file.exists(f) then dofile(f) end f="0_btn_flipflop.lua" if file.exists(f) then dofile(f) end - + + f = "0_zdyndns.lua" if file.exists(f) then dofile(f) end f="0_cron.lua" if file.exists(f) then dofile(f) end f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end - --f="0_tst3_socat.lua" if file.exists(f) then dofile(f) end --f = "web_ide2.lua" if file.exists(f) then dofile(f) end print("verbose:",verbose) diff --git a/Workshop/200303/btn_led_remote/btn/wifi_cli_conf.lua b/Workshop/200303/btn_led_remote/btn/wifi_cli_conf.lua index 14b0c04..ae19e69 100644 --- a/Workshop/200303/btn_led_remote/btn/wifi_cli_conf.lua +++ b/Workshop/200303/btn_led_remote/btn/wifi_cli_conf.lua @@ -1,4 +1,4 @@ -- Petit script pour configurer le client WIFI du NodeMCU -print("\n wifi_cli_conf.lua zf200302.2353 \n") +print("\n wifi_cli_conf.lua zf200303.1533 \n") wifi.sta.config{ssid="NodeMCU btn 3a:2b:78:04:2d:2d", pwd="12345678", save=true} diff --git a/Workshop/200303/script1.lua b/Workshop/200303/script1.lua new file mode 100644 index 0000000..3618b4c --- /dev/null +++ b/Workshop/200303/script1.lua @@ -0,0 +1,16 @@ +a=0.5 +b=3 +print(a*b) +print(a+b) + +c=a*b + +print("la valeur de c est: ",c) + +gpio.mode(0,gpio.OUTPUT) + +if c>=3 then + gpio.write(0,0) +else + gpio.write(0,1) +end diff --git a/Workshop/200303/script2.lua b/Workshop/200303/script2.lua new file mode 100644 index 0000000..19b2e15 --- /dev/null +++ b/Workshop/200303/script2.lua @@ -0,0 +1,24 @@ +-- Programme qui allume la led bleue quand on appuie le bouton flash +-- zf181011.1749 + +print("\n btn_led.lua zf200302.2356 \n") + + +zledbleue=0 --led bleue +zswitch=3 --switch flash + +gpio.mode(zswitch, gpio.INT, gpio.PULLUP) + +function zbtn() + if gpio.read(zswitch)==0 then + zled_state="ON" + gpio.write(zledbleue, gpio.LOW) + else + zled_state="OFF" + gpio.write(zledbleue, gpio.HIGH) + end + print("btn_led: "..zled_state) + --disp_send() +end + +gpio.trig(zswitch, "both", zbtn) diff --git a/zflash-epfl.sh b/zflash-epfl.sh new file mode 100644 index 0000000..9561bc5 --- /dev/null +++ b/zflash-epfl.sh @@ -0,0 +1,38 @@ +#!/bin/bash +#Petit script pour flasher facilement les NodeMCU avec un firmware + +#ATTENTION: c'est pour ma structure, il faudra donc l'adapter + +#zf191231.1746 + + +#test si l'argument est vide +if [ -z "$1" ] + then + echo -e "\nSyntax: + +Pour le dernier firmware à la mode: +./zflash.sh ../../Firmware/nodemcu-master-16-modules-2019-12-01-22-17-07-float.bin +./zflash.sh ../../Firmware/nodemcu-master-11-modules-2019-12-15-16-45-47-float.bin +./zflash.sh ../../Firmware/nodemcu-master-18-modules-2019-12-17-20-28-32-float.bin +./zflash.sh ../../Firmware/nodemcu-master-12-modules-2019-12-21-11-05-58-float.bin +./zflash.sh ../../Firmware/nodemcu-master-19-modules-2019-12-31-16-40-12-float.bin + +Pour l'ancien qui supporte encore le DS18B20: +./zflash.sh ../../Firmware/nodemcu-master-20-modules-2019-06-01-12-50-39-float.bin + + + +" + exit +fi + +echo ---------- start zflash.sh + +cd ./Tools/esptool-master + +python3 esptool.py erase_flash +sleep 2 +python3 esptool.py write_flash -fm dio 0x00000 $1 +sleep 2 +screen /dev/cu.wchusbserial1420 115200