Skip to content
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

How to configure baudrate and port #97

Closed
tkumark opened this issue Jan 1, 2024 · 2 comments
Closed

How to configure baudrate and port #97

tkumark opened this issue Jan 1, 2024 · 2 comments

Comments

@tkumark
Copy link

tkumark commented Jan 1, 2024

I am trying to rewrite below python code in flutter/dart. I would like to how to set port,baudrate,parity,bytesize and open readline connection?

import time
import serial
import re

ser = serial.Serial(
    port='/dev/ttyS0',
    baudrate=115200,
    parity=serial.PARITY_NONE,
    stopbits=serial.STOPBITS_ONE,
    bytesize=serial.SEVENBITS,
)

ser.isOpen()
out = ''
for i in range(10):
    waitingQueue = ser.inWaiting()
    if waitingQueue == 0:
        weight = "-- kg"
    else:
        out = ser.readline()
        if out != '':
            print(str(out))
            m = re.search('\s\s(.+?)\s\s\s\s', str(out))
            if m != None:
                weight = m.group(1)
            else:
                weight = "Extract Error"
    print(weight.strip())

ser.close()
@sayanp23
Copy link

Hi, Did anyone got solution for setting the Baudrate?? If you've found any solution please help me out, thanks.

@lucafabbri
Copy link
Collaborator

Please se #29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants