From f82b31c2b589fae0a29a0043417e3d6d1cc9a4fd Mon Sep 17 00:00:00 2001 From: neo Date: Mon, 24 Jun 2024 17:48:55 +0200 Subject: [PATCH] added lifecycle test --- Tools/lifecycle_test.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Tools/lifecycle_test.py diff --git a/Tools/lifecycle_test.py b/Tools/lifecycle_test.py new file mode 100644 index 0000000..eb06509 --- /dev/null +++ b/Tools/lifecycle_test.py @@ -0,0 +1,30 @@ +import serial +import time + +# Serial Port Configuration +port = '/dev/ttyUSB0' # Replace with your actual serial port (e.g., 'COM3' on Windows) +baudrate = 57600 # Replace with your desired baud rate +timeout = 1 # Optional timeout for read operations (in seconds) + +NUM_CYCLES = 100000 + +# Serial Connection Setup +try: + ser = serial.Serial(port, baudrate, timeout=timeout) + print(f"Connected to serial port: {port}") + + ser.write("fts arm\n".encode()) # Encode string to bytes for transmission + print(f"Sent ARM") + + cnt = 0 + while cnt < NUM_CYCLES: + ser.write("fts fire\n".encode()) # Encode string to bytes for transmission + print(f"Sent FIRE # {cnt}") + time.sleep(1) # Wait for 1 second + ser.write("fts reset\n".encode()) # Encode string to bytes for transmission + print(f"Sent RESET") + time.sleep(1) # Wait for 1 second + cnt+=1 + print("----------TEST FINISHED----------") +except serial.SerialException as e: + print(f"Error opening serial port: {e}") \ No newline at end of file