Files
NodeMCU_Lua/Workshop/181015/btn_led.lua
Christian Zufferey 5776cfbdfd - fait un petit hello world tout complet avec le init.lua
- refactorisé les initz.lua tous les mêmes
- enlevé les scripts script*
- refactorisé le start_boot
- le worshop est donc tout bien propre maintenant ;-)
2018-10-17 14:44:28 +02:00

24 lines
505 B
Lua

-- Programme qui allume la led bleue quand on appuie le bouton flash
-- zf181011.1749
print("\n btn_led.lua zf181016.1957 \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(zled_state)
end
gpio.trig(zswitch, "both", zbtn)