Tutorial by Examples

import serial #Serial takes these two parameters: serial device and baudrate ser = serial.Serial('/dev/ttyUSB0', 9600)
Initialize serial device import serial #Serial takes two parameters: serial device and baudrate ser = serial.Serial('/dev/ttyUSB0', 9600) to read single byte from serial device data = ser.read() to read given number of bytes from the serial device data = ser.read(size=5) to read one li...
To get a list of available serial ports use python -m serial.tools.list_ports at a command prompt or from serial.tools import list_ports list_ports.comports() # Outputs list of available serial ports from the Python shell.

Page 1 of 1