arduinoHow Python integrates with Arduino Uno


Syntax

  • Serial.begin(baudrate) // Set baud rate (bits per second) for serial data transmission
  • Serial.println(value) // Print data to serial port followed by Carriage Return \r and Newline character \n
  • serial.Serial((port=None, baudrate=9600, bytesize=EIGHTBITS, parity=PARITY_NONE, stopbits=STOPBITS_ONE, timeout=None, xonxoff=False, rtscts=False, write_timeout=None, dsrdtr=False, inter_byte_timeout=None) // Initialize serial port with all parameters
  • serial.readline() // Read serial data which contains Carriage Return \r and Newline character \n

Parameters

ParameterDetails
serialPython package contains classes and methods to access serial port
timePython package includes time-related functions

Remarks

I use an Arduino Uno with Arduino IDE 1.6.9 and Python 2.7.12 running in Windows 10.