-->
Page 3 of 3

Re: simple delay, wait or pause function

PostPosted: Mon Jan 07, 2019 5:01 am
by jim121049
The problem is it's not Lua.

Re: simple delay, wait or pause function

PostPosted: Mon Jan 07, 2019 5:17 am
by McChubby007
Yep, it's not Lua, it has grossly inefficient prints in it, and there are standard core C functions which do exactly what is required. Useless!

Re: simple delay, wait or pause function

PostPosted: Mon Mar 25, 2019 7:57 pm
by etfloyd
See this: https://github.com/etfloyd/nodemcu-taskqueue
Simple inline delay that won't ever annoy the watchdog:
Code: Select allrequire("TaskQueue")
tq = TaskQueue()
tq:start()

pin = 5
gpio.mode(pin, gpio.OUTPUT)

tq:schedule(nil, function(self)
  gpio.write(pin, gpio.HIGH)
  coroutine.yield(2)
  gpio.write(pin, gpio.LOW) 
end)