-
-
Notifications
You must be signed in to change notification settings - Fork 629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The example code pyserial doesn't work on windows, #4178
Comments
got more error when running on another windows system
|
This one works fine , import serial
from nicegui import app, run, ui
ui.input('Send command').on('keydown.enter', lambda e: (
ser.write(f'{e.sender.value}\n'.encode()),
e.sender.set_value(''),
))
log = ui.log()
async def read_loop() -> None:
global ser
ser = serial.Serial('COM1',115200,timeout=5)
while not app.is_stopped and ser.is_open:
line = await run.io_bound(ser.readline)
if line:
log.push(line.decode())
ser.close()
app.on_startup(read_loop)
ui.run() |
run.io_bond() is too slow. serial_asyncio is much better . |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
pyserial works fine without nicegui,but when running the example on windows,this error occurred ,
It seems than we must open the port first
The text was updated successfully, but these errors were encountered: