added lifecycle test

This commit is contained in:
neo 2024-06-24 18:12:03 +02:00
parent f82b31c2b5
commit d420fae1f3

View File

@ -1,3 +1,5 @@
from datetime import datetime
import serial import serial
import time import time
@ -5,8 +7,8 @@ import time
port = '/dev/ttyUSB0' # Replace with your actual serial port (e.g., 'COM3' on Windows) port = '/dev/ttyUSB0' # Replace with your actual serial port (e.g., 'COM3' on Windows)
baudrate = 57600 # Replace with your desired baud rate baudrate = 57600 # Replace with your desired baud rate
timeout = 1 # Optional timeout for read operations (in seconds) timeout = 1 # Optional timeout for read operations (in seconds)
datetime_format = '%Y-%m-%d %H:%M:%S'
NUM_CYCLES = 100000 NUM_CYCLES = 150000
# Serial Connection Setup # Serial Connection Setup
try: try:
@ -19,10 +21,12 @@ try:
cnt = 0 cnt = 0
while cnt < NUM_CYCLES: while cnt < NUM_CYCLES:
ser.write("fts fire\n".encode()) # Encode string to bytes for transmission ser.write("fts fire\n".encode()) # Encode string to bytes for transmission
print(f"Sent FIRE # {cnt}") current_time = datetime.now().strftime(datetime_format)
print(f"{current_time} Sent FIRE # {cnt}")
time.sleep(1) # Wait for 1 second time.sleep(1) # Wait for 1 second
ser.write("fts reset\n".encode()) # Encode string to bytes for transmission ser.write("fts reset\n".encode()) # Encode string to bytes for transmission
print(f"Sent RESET") current_time = datetime.now().strftime(datetime_format)
print(f"{current_time} Sent RESET")
time.sleep(1) # Wait for 1 second time.sleep(1) # Wait for 1 second
cnt+=1 cnt+=1
print("----------TEST FINISHED----------") print("----------TEST FINISHED----------")