lua-users home
lua-l archive

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

Of course I have already read in the mailing list but anyway I could not get success, so I wrote in the lua mailing list, I think I would find a quickly solution, but nobody answer about it, althought it's a very common task I think (comm with a serial device).
Well now I can write a solution to the problem: yes it isn't necessary to use any addon, with the lua IO library I finally can to communicate with a modem, this is the correct code:
local file="/dev/ttyS1"
local fd_r=assert(,"r"))
local fd_w=assert(,"w"))
fd_w:setvbuf("no")  --no buffering

print("writing: ",cmd)
r = fd_r:read("*l")
print("reading1: ",r)  --read that I've write
r = fd_r:read("*l")
print("reading2: ",r)  --real answer

Thanks for all.

----- Mensaje original ----
De: Asko Kauppi <>
Para: Lua list <>
Enviado: miércoles, 24 de octubre, 2007 18:23:17
Asunto: Re: How to use serial port to communications

Lua mailing list search:

"serial interface" ->

Super Macho kirjoitti 24.10.2007 kello 16:55:

I know and use lua certain time ago, but until now I have not need the use of serial port to communicate with for example a modem device. I have tried to use io library and to use and file:write and file:read but there is not ok communication.
Is possible with this library? or is it necesary some kind of extension or addon?
Help me please, thanks.

Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden! .

Sé un Mejor Amante del Cine
¿Quieres saber cómo? ¡Deja que otras personas te ayuden! .