Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import sys
import serial
def openConnection():
port = "/dev/ttyACM0"
baudrate = 9600
timeout = 0.2
try:
ser = serial.Serial(port=port, baudrate=baudrate, timeout=timeout)
print("Opening port " + ser.name + " ... DONE!")
except serial.SerialException as e:
print(e)
sys.exit(1)
ser = None
openConnection()
if ser is None:
print("ser is None")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.