Raspberry PI uses python+pyserial for serial communication (RPM)

Source: Internet
Author: User

Raspberry Pi uses python+pyserial to realize serial communicationExt.: http://blog.csdn.net/homeway999/article/details/8642353

Directory (?) [+]

    1. Raspberry Pi uses pythonpyserial to realize serial communication
      1. Raspberry Pi End Mount Pyserial
      2. Method 1source Installation
      3. Method 2pip Installation
      4. Raspberry PI Terminal connection serial port
      5. 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.