lua-users home
lua-l archive

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


Thank you very much for all of your answers.

I tried to install ynezz/librs232, but when I execute :

> ./configure --build=i686-pc-linux-gnu --host=mips-openwrt-linux-uclibc --target=mips-openwrt-linux-uclibc --prefix=$PWD/dist

I got this message :

configure: WARNING:
*** Lua (>=5.0) headers and/or librairies couldn't be found in your system.
*** Try to install liblua, liblualib and liblua-dev with your software package manager.
*** librs232 will be built without Lua bindings library.
./configure: line 11854: 1: command not found

But I have all this packages installed. Do you know if there is something that I am missing?
I check the configure file, it checks if I have lua in my system, but as I am cross compiling I think it should just get the headers and not the compiling flags.


Now I am testing ser2net, it works really well, I tested with telnet. I just have a simple (maybe stupid) question, I am really new in Lua : In my Lua code, when I write:

> require "nixio"
> nixio.connect(localhost, 2001, "inet", "stream")
> so = nixio.connect(localhost, 2001, "inet", "stream")
> print(so)
nixio socket 4
> so.send("test")
stdin:1: bad argument #1 to 'send' (nixio.socket expected, got string)
stack traceback:
    [C]: in function 'send'
    stdin:1: in main chunk
    [C]: ?
>

the variable so is not a nixio.socket ?

Thanks!

Helen Fornazier


On Fri, Mar 29, 2013 at 2:43 PM, <mlepage@antimeta.com> wrote:
I have successfully used ynezz to talk to a serial port on an Arduino, about a year ago.

Sent from my new BlackBerry Z10

From: Thijs Schreijer
Sent: Friday, March 29, 2013 7:13 AM
To: Lua mailing list
Reply To: Lua mailing list
Subject: RE: Lua and Serial Port

> -----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/