In many projects we want to have connection to PC. In most cases a serial interface works fine. Using it we can read data, send commands or simply debug program running on chip. Embedded programmers are looking for simple way controlling serial data flow. In many cases simple terminal is enough, but if you want to add some intelligence to program, then you need something more. One of great choices is Python. It is free, multiplatform tool that enables running programs using smart scripting language. Strong community has written tons of handy modules – libraries to do various tasks. One of these modules is called pyserial which allows accessing serial ports using simple functions. Pyserial is successfully used in many great projects so why not continue using it. Things changed a bit when Python3 has been released. The problem is that all modules were written for Python2. Developers of Python 3 decided not to add backwards compatibility to ver2. So many modules stopped working in Python3. Luckily pyserial is supported in Python3.
Tutorial from scienceprog gives a simple example on how to set up pyserial to be used with Python3.3. An example script shows how to read incoming text messages from serial line and displays on console screen. As test data there were ASCII table sent from ChipKIT UNO32. Given example could serve as starting point for new project that connect microcontrollers to PC.
For All Your PCB Need, One-stop PCB Solution Services Appear: