gpio.mode(1,gpio.OUTPUT)
gpio.mode(2,gpio.INPUT,gpio.PULLUP)
if (gpio.read(2)==1) then
gpio.write(1,gpio.HIGH)
else
gpio.write(1,gpio.LOW)
end
In this code ,if i connect the pin 2 to ground, the led connected to pin 1 should turn off instead it keeps on glowing.