using external DLLs for serial ports is going to be a nightmare...
I tried various solutions but nothing stable enough.
I would prefer to rely on simpler LuaRT code. So I tried the example code below:
local portName = '\\\\.\\COM4'
local sf = sys.File(portName)
print(sf) --> ok
sf:open('readwrite', 'binary') --> error
sf:write('help\n')
data = sf:read(1)
print(data)
sf:close()
But I got:
File: 000001AD3F2893F0
.../serial_demo2.lua :4: File open failed 'Permission denied'
Is there a reason why the following LuaRT code is not working?
Using a serial terminal the device connected on COM4 is perfectly replying and I did not have any issue from Python as well.