Wrote a small program based on the github
example the luars232 module, however I get an error. Requesting help to understand, what is wrong here.
Also, what is the way to know for sure, that LfW is using one of these (original vs fork) as the batteries-included luars232 module ?
[code]
luars232 = require("luars232")
port_name="COM8"
local e, p = luars232.open(port_name)
if e ~= luars232.RS232_ERR_NOERROR then
print("Err: Port open failed for: "..port_name.." because: "..luars232.error_tostring(e))
else
-- initial setup of port
assert(p:set_baud_rate(luars232.RS232_BAUD_115200) == luars232.RS232_ERR_NOERROR)
assert(p:set_data_bits(luars232.RS232_DATA_8) == luars232.RS232_ERR_NOERROR)
assert(p:set_parity(luars232.RS232_PARITY_NONE) == luars232.RS232_ERR_NOERROR)
assert(p:set_stop_bits(luars232.RS232_STOP_1) == luars232.RS232_ERR_NOERROR)
assert(p:set_flow_control(luars232.RS232_FLOW_OFF) == luars232.RS232_ERR_NOERROR)
print("Ok: Port opened: "..port_name.." with values: "..tostring(p))
end
assert(p:close() == luars232.RS232_ERR_NOERROR)
[/code]
[error]
Program starting as '"C:\ZeroBraneStudio-master\bin\lua.exe" -e "io.stdout:setvbuf('no')" "C:Lua-programs\win_port_opener.lua"'.
Program 'lua.exe' started in '' (pid: 1760).
C:\ZeroBraneStudio-master\bin\lua.exe: C:\Lua-programs\win_port_opener.lua:11: calling 'set_baud_rate' on bad self (luars232 expected, got userdata)
stack traceback:
[C]: in function 'set_baud_rate'
C:\Lua-programs\win_port_opener.lua:11: in main chunk
[C]: at 0x00402a57
Program completed in 0.16 seconds (pid: 1760).
[/error]
thanks,
Jay