serial::construct()
The constructor. Create an instance of class serial and open the port
serial::construct(port, timeout = 30000, baudrate = 9600, bytesize = 8, parity = parity_none, stopbits = stopbits_one, flowcontrol = flowcontrol_none)
port (string) — The address of the serial port. For example: "/dev/ttyS0" in Linux/macOS, and "COM1" in Windowstimeout (number, optional) — Timeout for the serial port (in milliseconds). The default value is 30000baudrate (number, optional) — Baud rate value. The default value is 9600bytesize (number, optional) — Size of each byte in the serial transmission of data. The default value is 8parity (number, optional) — Method of parity. The default value is parity_nonestopbits (number, optional) — Number of stop bits used. The default value is stopbits_oneflowcontrol (number, optional) — Type of flow control used. The default value is flowcontrol_none
serial — Returns the instance of class serial and the handle to the opened port
import serial
arduino = serial("/dev/ttyACM0")
if arduino.is_open()
arduino.write("Hello")
arduino.close()
endif