Fixed Uart serial stuff

This commit is contained in:
Maximilian Giller 2024-05-02 22:10:52 +02:00
parent 7f4eae67f6
commit e44a78742e

View file

@ -5,7 +5,7 @@ class Mhz19Co2:
def __init__(self): def __init__(self):
self.last_read = None self.last_read = None
self.serial_port = "/dev/tty.usbserial-B001BTPZ" self.serial_port = "/dev/serial0"
self.baud_rate = 9600 self.baud_rate = 9600
self.byte_size = 8 self.byte_size = 8
self.parity = "N" self.parity = "N"
@ -18,6 +18,7 @@ class Mhz19Co2:
return self.last_read return self.last_read
def read(self): def read(self):
ser = None
try: try:
ser = serial.Serial( ser = serial.Serial(
port=self.serial_port, port=self.serial_port,