Skip to content

Allow synchronous execution of commands like sending data without callback and have a wait command which hides the use of a timer.

Notifications You must be signed in to change notification settings

HHHartmann/nodemcu-syncro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nodemcu-syncro

add synchronous execution of commands which originally have a callback to indicate execution.

Be able to write code like

for i = 1 to 10
  tcp.send("Hello World")
end

Also have preemptive multitasking: Start several coroutines which run synchronous code. Make sure to call wait or some other synchronous function which uses callbacks to allow other coroutines and the system to run.

function blinkLed(pin, interval)
  gpio.write(pin, gpio.HIGH)
  fw.wait(interval)
  gpio.write(pin, gpio.LOW)
  fw.wait(interval)
end

fw = dofile("SynchronousFramework.lua")
fw.start(blinkLed, 2, 20)    -- will call blinkLed(2, 20) in a separate coroutine
fw.start(blinkLed, 3, 17)

which will blink the leds in given intervals. See Examples for another example.

About

Allow synchronous execution of commands like sending data without callback and have a wait command which hides the use of a timer.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages