Partial auto-arduino-detection
This commit is contained in:
parent
0f4e189a6b
commit
aefe367a4d
1 changed files with 11 additions and 1 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
import os
|
||||||
|
|
||||||
import GPUtil
|
import GPUtil
|
||||||
import time
|
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 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"
|
# 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 = txfer.SerialTransfer(port, 115200, timeout=.1)
|
||||||
|
|
||||||
link.open()
|
link.open()
|
||||||
|
|
Loading…
Reference in a new issue