树莓派i2c python_树莓派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

1

2

$sudoapt-getinstall-ypython-smbus

$sudoapt-getinstall-yi2c-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!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值