Ver código fonte

'lol.py' löschen

maxscheinast 7 meses atrás
pai
commit
218371c0be
1 arquivos alterados com 0 adições e 31 exclusões
  1. 0 31
      lol.py

+ 0 - 31
lol.py

@@ -1,31 +0,0 @@
-def get_data():
-    import serial
-    import time
-
-    # Configure serial port (adjust port name as needed)
-    ser = serial.Serial('COM10', 9600)
-
-    # Wait for the serial connection to establish
-    ser.timeout = 2
-
-    #ser.write(b'testcom.py\n')  # Send command to start the script
-    while True:
-        
-        # Read data from serial port
-        data = ser.readline().decode().strip()
-
-        # Check if data is not empty
-        #print(data)
-        if data:
-            try:
-                # Attempt to convert data to float
-                value = float(data)
-                timestamp = time.time()
-                return timestamp, value
-            except ValueError:
-                print("Invalid data format:", data)
-        else:
-            print("Empty data received")
-        
-        # Add a small delay to prevent rapid looping
-        time.sleep(0.001)