Current Lua downloadable firmware will be posted here

User avatar
By sveinutne
#19325 Hi
pwm.setup(pin,1000,1024)
This is very good for changing duty cycle if you stay below 1000Hz, but I would like go go higher in frequency. Maybe as high as 4KHz. I do not need 10 bits for duty cycle. 8 is more that I need.
Is it possible to make a "private" version that got pwm.setup(pin,4000,256) as max?
What fiels do I need to change? I am new to NodeMCU. I use Windows 8.1
Regards
Svein Utne
svein_utne@hotmail.com
User avatar
By TerryE
#19561 Marcel, just a thought triggered by my own efforts to build my own firmware version on an RPi: as I was customising user_includes, I notice that there is an option to disable coroutine library support.

Coroutine is a nice feature but given my reading of the PiLv3 section on this, the event driven nature of the nodeMCU implementation (e.g. all event routines are lua_called from the firmware, and you've got to return control to avoid PANICs) means that coroutining isn't usable except in silly / trite examples. So why not consider a build option to drop this library as well?

I'll test this out and report back.
Last edited by TerryE on Sat Jun 06, 2015 11:12 am, edited 1 time in total.
User avatar
By cal
#19572
TerryE wrote:Coroutine is a nice feature but given my reading of the PiLv3 section on this, the event driven nature of the nodeMCU implementation (e.g. all event routines are lua_called from the firmware, and you've got to return control to avoid PANICs) means that coroutining isn't usable except in silly / trite examples.


That remembered me on something I wanted to discuss:
Why not "lua_pcall" more stuff so that at least we can provide a better error message possibly including debug
stacktrace before panicing (is that a word?).
I did that in the net area and it helped me.
I couldn't make my mind if there is a case for not panicing.

Cal