Using Raspi for I²c and ks103 communication via Quick2wire

Source: Internet
Author: User
Tags raspi

Original: http://www.cnblogs.com/hangxin1940/archive/2013/04/04/2999015.html

Previously described how to enable the I²c device http://www.cnblogs.com/hangxin1940/archive/2013/04/02/2997077.html and build a Python development environment HTTP// Www.cnblogs.com/hangxin1940/archive/2013/04/03/2997094.html

Quick2wire is a Python library for i²c communication on Raspberry Pi, which makes it easy to read and write Gpio pins with non-root users.

Why do you use it?

Some hardware devices for Linux, with high permissions, only root can operate, then in the development of these applications, to read and write some hardware devices, you have to have root identity, which brings the inconvenience, to know that the root user is the root of all evils , In case of Root, a inattention #:/ rm * , it is really regret.

Preparatory work
sudo apt-get install gitsudo apt-get install python3sudo apt-get install python-pipsudo apt-get install python-virtualenv
Installing Quick2wire-gpio-admin

The Quick2wire-gpio-admin tool provides an easy way to enable/disable a GPIO pin, which does not require the current user to have root privileges.

Download the Uick2wire-gpio-admin source code in the appropriate location:

wget https://github.com/quick2wire/quick2wire-gpio-admin/archive/master.zip

Or

git clone https://github.com/quick2wire/quick2wire-gpio-admin.git

Unzip the downloaded zip file and go to the extracted directory

Compiling the installation

makesudo make install

At this point, it is installed, and it exists as a command in the system gpio-admin .

Next, add the current PI user to the gpio group

sudo adduser pi gpio

Exit and log in again to make sure that changes to the user group take effect immediately. For more information on this command, please visit https://github.com/quick2wire/quick2wire-gpio-admin

Installing QUICK2WIRE-PYTHON-API

QUICK2WIRE-PYTHON-API relies on quick2wire-gpio-admin, and we've done that in the last step.

This library makes it easy for developers to quickly connect to the Raspberry Pi pin using python

Download the QUICK2WIRE-PYTHON-API source code in the appropriate location:

wget https://github.com/quick2wire/quick2wire-python-api/archive/master.zip

Or

git clone https://github.com/quick2wire/quick2wire-python-api.git

Unzip the downloaded zip file and go to the extracted directory

Install this Python library

python3 setup.py install

At this point, the installation is complete.

For a more detailed example, check out the Https://bitbucket.org/thinkbowl/i2clibraries

For more information, please refer to:

Use Quick2wire to access the GPIO pin http://github.com/quick2wire/quick2wire-python-api/blob/master/doc/getting-started-with-gpio.md

Using Quick2wire to access the i²c pin http://github.com/quick2wire/quick2wire-python-api/blob/master/doc/getting-started-with-i2c.md

Using Raspi for I²c and ks103 communication via Quick2wire

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.