Raspberry Pi uses python+pyserial to realize serial communicationExt.: http://blog.csdn.net/homeway999/article/details/8642353
Directory (?) [+]
- Raspberry Pi uses pythonpyserial to realize serial communication
- Raspberry Pi End Mount Pyserial
- Method 1source Installation
- Method 2pip Installation
- Raspberry PI Terminal connection serial port
- Windows Port connection serial port
Raspberry Pi uses python+pyserial to implement serial communication Raspberry PI side installation pyserial
Unix-like (LINUX,MAC) can be
Method 1:source Installation
Download pyserial
wget http://pypi.python.org/packages/source/p/pyserial/pyserial-2.6.tar.gz
Extract
Tar zxvf pyserial-2.6.tar.gz
Go to Catalog
CD pyserial-2.6
Installing the serial Module
Python setup.py Install
Method 2:pip Installation
sudo apt-get install-y python-pip
sudo pip install-y pyserial
Raspberry PI Terminal connection serial port
Same as other Linux and Macs (not tested)
Input in terminal
> $python
> >> Import serial
> >>> ser = serial. Serial ('/dev/ttyama0 ', 115200)
> >>> Ser.isopen ()
> True
> >>> ser.write (' 1 ')
> 1
Windows Port connection serial port
The use of serial tools (single-chip universal serial tools)
Or install Python and pyserial, by doing the following:
Install python First, then download the Pyserial package, and then refer to Method 1 above to unzip the installation. omitted here.
Connect the serial port, ditto, except for: Ser = serial. Serial ("COM6", 115200)
Raspberry PI uses python+pyserial for serial communication (RPM)