LED Grow using Button
LED glow using Button Input Method in While loop
gpio.config( { gpio=23, dir=gpio.OUT }, { gpio=0, dir=gpio.IN}) while(true) do if (gpio.read(0)==0) then gpio.write(23, 1) else gpio.write(23, 0) end end
LED glow using Button Interrupt Method
gpio.config({gpio=23, dir=gpio.OUT}) --GPIO-23 as OUTPUT gpio.trig(0, gpio.INTR_UP_DOWN,pin_interrupt_1) --GPIO-0 as INPUT function pin_interrupt_1(level) if (0 == gpio.read(0)) then gpio.write(23, 1) else gpio.write(23, 0) end end
LED Blink using Timer
gpio.config( { gpio=23, dir=gpio.OUT }) ArunEworld_timer = tmr.create() ArunEworld_timer:register(1000, tmr.ALARM_AUTO, function() if (gpio.read(23)==1) then gpio.write(23, 0) elseif (gpio.read(23)==0) then gpio.write(23, 1) end end) ArunEworld_timer:start()