Created
December 27, 2023 21:57
-
-
Save dewomser/0d0b32d880582f841473cfcc050c9095 to your computer and use it in GitHub Desktop.
Multimeter von Parkside Lidl und die serielle Schnittstelle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
# Modify the port name to match your serial port | |
port = serial.Serial('/dev/ttyUSB0', 2400, timeout=1, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE) | |
# Read data from the serial port | |
while True: | |
# Read 2-byte preamble | |
preamble = port.read(2) | |
# Check if the preamble is correct | |
if preamble == b'\xdc\xba': | |
# Read the 6th byte | |
data = port.read(10) | |
sixth_byte = data[5] | |
# Print the 6th byte | |
print(f"The 6th byte is {sixth_byte}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ist ein einfaches Beispiel . Dieses Script funktioniert nur mit dem Durchgangsprüfer. Werte 0 und 255 .
Bing-Chat hat dabei geholfen.