[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: serial port trouble on Win10
- From: Sean Conner <sean@...>
- Date: Sat, 10 Oct 2020 15:56:02 -0400
It was thus said that the Great Ulrich Schmidt once stated:
> Am 10.10.2020 um 08:51 schrieb Sean Conner:
> >It was thus said that the Great Ulrich Schmidt once stated:
> >>I can open the serial port via io.open() but this approach works in
> >>buffered mode and my short messages get stuck in the transmit buffer.
> > Two possible solutions:
> >1. use file:flush() after writing data to ensure the buffer is written.
> >2. use file:setvbuf('no') immediately after opening the serial port to
> > all buffering of data.
> > -spc (And that's all the ideas I have)
> Solution 2. worked so far as i can send short commands to my hardware.
> Thank You. For doing so, i had to open the file in write mode.
> Unfortunately i cant read this port. To read, i need to open the file in
> read mode but cant send anymore.
You can open a file for reading and writing by using "r+" for the mode
when opening the file. The wording for "r+" in the Lua manual labels this
mode as "update mode" (and in my opinion might not be clear about opening
the file in read/write mode).
> Thats probably the reason Steve Donovan did a lot of magic behind the
> scene in his winapi module.
That, and to (probably) allow one to configure the serial port (speed,