Skip to content

Instantly share code, notes, and snippets.

@thewh1teagle
Created December 28, 2023 23:57
Show Gist options
  • Select an option

  • Save thewh1teagle/16b71a8fdf8c6343c0b247a44a90d8a2 to your computer and use it in GitHub Desktop.

Select an option

Save thewh1teagle/16b71a8fdf8c6343c0b247a44a90d8a2 to your computer and use it in GitHub Desktop.
enumerate devices pyserial
import os
import serial
if os.name == 'nt': # sys.platform == 'win32':
from serial.tools.list_ports_windows import comports
elif os.name == 'posix':
from serial.tools.list_ports_posix import comports
ports = comports()
for port in ports:
print(port.device)
if port.pid == 10: # PI Pico
print('reset device', port)
ser = serial.Serial(port=port.device)
ser.baudrate = 1200
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment