-->
Page 5 of 6

Re: GPIO sampling speed?

PostPosted: Thu Dec 01, 2016 4:25 pm
by Robert1968
Hi,

I compared speed of a 160 MHz ESP8266 with 3 different programming language:
LUA , Micropython, and Arduino IDE.

Result: C++ is 20 times faster than LUA. (6KHz, 12KHz, and 124 KHz )

See results here: http://esp8266freq.blogspot.hu/p/blog-page.html

Re: GPIO sampling speed?

PostPosted: Thu Jan 26, 2017 9:10 am
by 1314258
@raz123

is it possible to write a ir sender by lua?
i wrote one,but i think that the lua cannot fast enough to send a 38khz light.
may be the code is too dirty.

Code: Select all   local function mark(mtime)
      local begin=tmr.now()
      while(tmr.now()-begin<mtime)
         do
            write(irpin,1)
            waitus(halfPeriodicTime)
            write(irpin,0)
            waitus(halfPeriodicTime)
         end
   end

Re: GPIO sampling speed?

PostPosted: Thu Jan 26, 2017 4:39 pm
by devsaurus
I guess that there are too many inaccuracies when doing this from Lua.
Check gpio.serout() instead: http://nodemcu.readthedocs.io/en/master ... gpioserout

Re: GPIO sampling speed?

PostPosted: Thu Jan 26, 2017 5:11 pm
by marcelstoer
devsaurus wrote:I guess that there are too many inaccuracies when doing this from Lua.


We've had and example in our repo at https://github.com/nodemcu/nodemcu-firm ... irsend.lua for quite some time but I have no idea whether that still works.