[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: Lua and Serial Port
- From: Thijs Schreijer <thijs@...>
- Date: Fri, 29 Mar 2013 11:09:55 +0000
> -----Original Message-----
> From: lua-l-bounces@lists.lua.org [mailto:lua-l-bounces@lists.lua.org] On
> Behalf Of Helen Fornazier
> Sent: vrijdag 29 maart 2013 12:04
> To: lua-l@lists.lua.org
> Subject: Lua and Serial Port
>
> Hello!
>
> I am new in Lua and I just start developing for OpenWRT in a Dragino
> platform.
>
> I want to develop an application that reads data from Uart and print it in
> a Luci based web page.
> But I am having a problem that I described here :
> http://stackoverflow.com/questions/15701694/lua-io-read-sends-me-an-echo-
> back-when-i-read-from-serial-port-why
> When I execute the code :
> print("Dragino Uart Test started\n")
> while 1 do
> serialin=io.open("/dev/ttyS0","r")
> print(serialin:read()) --print the data
> serialin:close()
> end
> I read the serial port but I receive an echo too and the read() waits
> until a new line character to return.
>
>
> There is any other way to read from a serial port ?
Have you tried the serial libraries? See https://github.com/ynezz/librs232/
Alternatively, I read somewhere that the upcoming release of LuaSocket also supports serial connections. See https://github.com/diegonehab/luasocket
> Thank you for your help, I appreciate it.
>
> --
> Helen Fornazier
> http://www.wizzilab.com/