树莓派2B启用I2C

树莓派自带I2C控制器,但是默认没有启用,我们需要手工启用,具体操作如下:

I2C is a very commonly used standard designed to allow one chip to talk to another. So, since the Raspberry Pi can talk I2C we can connect it to a variety of I2C capable chips and modules.Here are some of the Adafruit projects that make use of I2C devices and modules:

The I2C bus allows multiple devices to be connected to your Raspberry Pi, each with a unique address, that can often be set by changing jumper settings on the module. It is very useful to be able to see which devices are connected to your Pi as a way of making sure everything is working.

To do this, it is worth running the following commands in the Terminal to install the i2c-tools utility.

$ sudo apt-get install -y python-smbus
$ sudo apt-get install -y i2c-tools

Installing Kernel Support (with Raspi-Config)

Run sudo raspi-config and follow the prompts to install i2c support for the ARM core and linux kernel

Go to Interfacing Options

On older versions, look under Advanced

then I2C

Enable!

Then reboot!

参考链接


Configuring I2C

发布者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注