Skip to content

Commit

Permalink
smbus to smbus2
Browse files Browse the repository at this point in the history
  • Loading branch information
zhen-upup committed Sep 6, 2021
1 parent 1f5c45a commit a4ecd73
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Python/31_bmp280.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#!/usr/bin/env python3
import time
import RPi.GPIO as GPIO
import smbus
import smbus2 as smbus
class BMP280:
# this value is necessary to calculate the correct height above sealevel
# its also included in airport wheather information ATIS named as QNH
Expand Down
2 changes: 1 addition & 1 deletion Python/32_mpu6050.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/python3

import smbus
import smbus2 as smbus
import math
import time

Expand Down
2 changes: 1 addition & 1 deletion Python/LCD1602.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3

import time
import smbus
import smbus2 as smbus

BUS = smbus.SMBus(1)

Expand Down
2 changes: 1 addition & 1 deletion Python/PCF8591.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# ADC.write(Value) # Value range from 0 to 255
#
#------------------------------------------------------
import smbus
import smbus2 as smbus
import time

# for RPI version 1, use "bus = smbus.SMBus(0)"
Expand Down
4 changes: 2 additions & 2 deletions docs/source/appendix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ above – since the address of the device is 0x48, 48 is printed.
sudo apt-get install libi2c-dev
**For Python users:** Install smbus for I2C.
**For Python users:** Install smbus2 for I2C.

.. raw:: html

<run></run>

.. code-block::
sudo apt-get install python3-smbus
sudo pip3 install smbus2
**Copyright Notice**

Expand Down
4 changes: 2 additions & 2 deletions docs/source/lesson_31.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ step.)
**For Python Users:**

**Step 3:** Install smbus for I2C.
**Step 3:** Install smbus2 for I2C.

.. raw:: html

<run></run>

.. code-block::
sudo apt-get install python3-smbus i2c-tools
sudo pip3 install smbus2
**Step 4:** We'll need to install some utilities for the Raspberry Pi to
communicate over I2C.
Expand Down
2 changes: 1 addition & 1 deletion docs/source/lesson_32.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ step.)
.. code-block:: python
#!/usr/bin/python3
import smbus
import smbus2 as smbus
import math
import time
Expand Down

0 comments on commit a4ecd73

Please sign in to comment.