166
Vývoj / Re:Python citanie s COM portu a odstranenie "balastu"
« kdy: 13. 12. 2020, 20:35:45 »
Tak nakoniec aj ked nie som 2x happy
Kód: [Vybrat]
import serial
import re
s = serial.Serial('COM3')
QR_code_data = ""
while True:
res = s.read_until(b"\x03").decode('UTF-8')
QR_code_data = res
QR_code_data = re.sub('[^A-Za-z0-9]+', '', QR_code_data)
QR_code_data = QR_code_data [2:] #toto lebo to davalo Q1 ale netusim preco?
print (QR_code_data)