From aefe367a4d3b36081c9c28ee32e80f3703e3efb6 Mon Sep 17 00:00:00 2001 From: askiiart Date: Tue, 25 Oct 2022 06:29:52 -0500 Subject: [PATCH] Partial auto-arduino-detection --- Python/tx_speed.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Python/tx_speed.py b/Python/tx_speed.py index f414e61..0cfb6c3 100644 --- a/Python/tx_speed.py +++ b/Python/tx_speed.py @@ -1,3 +1,5 @@ +import os + import GPUtil import time @@ -10,7 +12,15 @@ try: # On Linux, it will be "/dev/ttyXXX#", like "/dev/ttyACM0" or "/dev/ttyUSB0". I think macOS is the same. # On Windows, it will be "COM#", like "COM3" # --- - port = '/dev/ttyACM2' + port = '/dev/ttyACM0' + + arduino_connected = False + from subprocess import getoutput + while not arduino_connected: + ports = getoutput('ls /dev | grep ttyACM').split('\n') + ports = sorted(ports) + + link = txfer.SerialTransfer(port, 115200, timeout=.1) link.open()