lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sorry the complete question

The program:

local rs232 = require "rs232"

local p, e = rs232.port('ttyUSB0',{
  baud         = '_57600';
  data_bits    = '_8';
  parity       = 'NONE';
  stop_bits    = '_1';
  flow_control = 'OFF';
  rts          = 'ON';
})


p:open()
print(p:write('AT\r\n'))


The error:

[josema@marengo NanoPlayBoard]$ sudo lua ejemplocom.lua
lua: /usr/share/lua/5.3/rs232.lua:265: attempt to index a nil value (field '_p')
stack traceback:
    /usr/share/lua/5.3/rs232.lua:265: in method 'write'
    ejemplocom.lua:14: in main chunk
    [C]: in ?


2017-11-05 18:57 GMT+01:00 José María Martínez García <josemar1992@gmail.com>:
Ok Pierre.
I installed :
1) Lua (last version) from scratch (compiling and installing)
2) Luarocks (last version) from scratch (compiling and installing)
3) realine-devel from dnf pakage manager (Fedora 25)
4) From luarocks i installed rs232

All of them with no errors.
Now i'm trying to use rs232 library.

This is my program:

local rs232 = require "rs232"

local p, e = rs232.port('ttyUSB0',{
  baud         = '_57600';
  data_bits    = '_8';
  parity       = 'NONE';
  stop_bits    = '_1';
  flow_control = 'OFF';
  rts          = 'ON';
})

p:open()
print(p:write('AT\r\n'))

An this is the error. I'm sure tha port ttyUSB0 is in use and ready

Thankyou



--
José María
@itubalibre
http://itubal.github.io/




--
José María
@itubalibre
http://itubal.github.io/