i wanto to send a brodcast on my lan when GPIO2 goes high. I have a listner on my pc and with this code
su=net.createConnection(net.UDP)
su:on("receive",function(su,c) print(c) end)
su:connect(8889,"192.168.1.255")
pin=8
gpio.mode(pin,gpio.INPUT)
if gpio.read(pin)==1 then
su:send("ok")
print("ok")
else
print("NO INPUT")
end
First of all, how to create a loop that wait for the input on GPIO2 ?