Lua serial library. Wich?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Lua serial library. Wich?

José María Martínez García
Hello all.
Sorry.
I'm searching a Lua library for serial communication.

I'd found "lua-serial" in Github, but it seems that works on Win32, Win64, and Linux 32 but not on Linux 64. I can't compile it.

Also I'd found a rs232 in Luarocks but it seems that are necessary a lot of dependencies. I tried to install some of them but i obtained a lot of errors and the dependencies list grown up quickly.

Thankyou for reading.


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

Reply | Threaded
Open this post in threaded view
|

Re: Lua serial library. Wich?

dyngeccetor8
On 11/05/2017 09:14 AM, José María Martínez García wrote:

> Hello all.
> Sorry.
> I'm searching a Lua library for serial communication.
>
> I'd found "lua-serial" in Github, but it seems that works on Win32, Win64, and
> Linux 32 but not on Linux 64. I can't compile it.
>
> Also I'd found a rs232 in Luarocks but it seems that are necessary a lot of
> dependencies. I tried to install some of them but i obtained a lot of errors and
> the dependencies list grown up quickly.

I had similar problem when mated Lua with Arduino. Bare opening device as file
works well:

  file_name = '/dev/ttyUSB0'

  comm_read = assert(io.open(file_name, 'r'))
  comm_read:setvbuf('no')
  comm_read:flush()

  comm_write = assert(io.open(file_name, 'w'))
  comm_write:setvbuf('no')
  comm_write:flush()


Or you need some specific features?

-- Martin

Reply | Threaded
Open this post in threaded view
|

Re: Lua serial library. Wich?

Enrico Colombini
On 05-Nov-17 15:10, dyngeccetor8 wrote:

> I had similar problem when mated Lua with Arduino. Bare opening device as file
> works well:
>
>    file_name = '/dev/ttyUSB0'
>
>    comm_read = assert(io.open(file_name, 'r'))
>    comm_read:setvbuf('no')
>    comm_read:flush()
>
>    comm_write = assert(io.open(file_name, 'w'))
>    comm_write:setvbuf('no')
>    comm_write:flush()
>
>
> Or you need some specific features?

Interesting. But how do you set serial speed and port features (byte
format, no echo, no hardware handshake, raw data, etc.)?

--
   Enrico

Reply | Threaded
Open this post in threaded view
|

Re: Lua serial library. Wich?

dyngeccetor8
On 11/05/2017 02:21 PM, Enrico Colombini wrote:

> On 05-Nov-17 15:10, dyngeccetor8 wrote:
>> I had similar problem when mated Lua with Arduino. Bare opening device as file
>> works well:
>>
>>    file_name = '/dev/ttyUSB0'
>>
>>    comm_read = assert(io.open(file_name, 'r'))
>>    comm_read:setvbuf('no')
>>    comm_read:flush()
>>
>>    comm_write = assert(io.open(file_name, 'w'))
>>    comm_write:setvbuf('no')
>>    comm_write:flush()
>>
>>
>> Or you need some specific features?
>
> Interesting. But how do you set serial speed and port features (byte format, no
> echo, no hardware handshake, raw data, etc.)?

I guess this is done somewhere in OS layer. I was amazed too that opening
'/dev/ttyUSB<N>' works. Also did search with Lua maillist, there is mention for
this way.

(My case was linking Arduino module (which uses serial protocol over USB with
preset 9600 baud speed) with Love graphic frontend. So given snippet is from
real code.)

-- Martin