We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55ed7c6 commit d7f237cCopy full SHA for d7f237c
find_arduino.py
@@ -0,0 +1,28 @@
1
+from boards import boards_dict
2
+from serial.tools import list_ports
3
+import re
4
+
5
+def check_ports():
6
+ not_arduinos = []
7
+ arduinos = []
8
+ for connection in list_ports.comports():
9
+ port,hwid,desc = connection
10
+ vid_pid = re.search(r"(?<=VID\:PID\=)[0-9|A-Z|a-z]{4}\:[0-9|A-Z|a-z]{4}", desc)
11
+ vid_pid = None if vid_pid is None else vid_pid.group()
12
+ print(vid_pid)
13
+ if vid_pid is None:
14
+ not_arduinos.append(connection)
15
+ else:
16
+ try:
17
+ board = boards_dict[vid_pid]
18
+ arduinos.append((board,connection))
19
+ except KeyError:
20
21
+ return arduinos, not_arduinos
22
23
+if __name__ == "__main__":
24
+ arduinos, not_arduinos = check_ports()
25
+ for ard in arduinos:
26
+ print(ard)
27
+ for nard in not_arduinos:
28
+ print(nard)
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments