Re: remote control with only esp8266
Posted: Mon Nov 30, 2020 5:00 pm
there must be something wrong in init.lua
somewhere you can read
followed by some stack trace
that could be the reason of all the garbage on the serial interface
remove that file and try this, it's a trivial led blink every 5 secs
somewhere you can read
Code: Select all
...attempt to call field 'alarm'. (a nil value ...
followed by some stack trace
that could be the reason of all the garbage on the serial interface
remove that file and try this, it's a trivial led blink every 5 secs
Code: Select all
-- init.lua
led_on = false
gpio.mode(4, gpio.OUTPUT)
gpio.write(4, gpio.HIGH)
periodic_task = function()
if (led_on) then
-- turn off the led
print("led off")
gpio.write(4, gpio.HIGH)
led_on = false
else
-- turn on the led
print("led on")
gpio.write(4, gpio.LOW)
led_on = true
end
tmr.create():alarm(5000, tmr.ALARM_SINGLE, periodic_task)
end
print("now running the application")
tmr.create():alarm(5000, tmr.ALARM_SINGLE, periodic_task)