Post your best Lua script examples here
User avatar
By lua2018
#68277 Hello,
I´m new in this forum and have a Problem.
Who can I read a switch on a gpio in my prgramm?
Because then I past this programm
Code: Select alli = 1
switch1 = 4
gpio.mode(switch1, gpio.INPUT)
while i ==1 do
    if gpio.read(switch1) == 1 then
       print("Hello")
    end
end

I become this output:
Code: Select allHello
.....
Hello
Hello
Hello
HeÆåbLŽ„9ÿŒ,!Î@h…ä@Hàø

NodeMCU 0.9.5 build 20150318  powered by Lua 5.1.4
Hello
Hello
Hello
.....

but the switch isn´t close.
Can anyone help me, please?
I hope my English ist not so bead :D