File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 1- # VL53L0X Python interface on Raspberry Pi
1+ # VL53L0X Python interface on Raspberry Pi/Jetson TX2
22
33This project provides a simplified python interface on Raspberry Pi to the ST VL53L0X API (ST Microelectronics).
44
@@ -9,6 +9,11 @@ In order to be able to share the i2c bus with other python code that uses the i2
99Version 1.0.2:
1010- Add support for TCA9548A I2C Multiplexer. Tested with https://www.adafruit.com/products/2717 breakout. (johnbryanmoore)
1111- Add python example using TCA9548A Multiplexer support (johnbryanmoore)
12+ - Add pip install support (grantramsay)
13+ - Add smbus2 support (grantramsay)
14+ - ** Add smbus/smbus2 support (naisy)**
15+ - ** Add gcc -fPIC flag (naisy)**
16+ - ** Add I2C address change support (naisy)**
1217
1318Version 1.0.1:
1419- Simplify build process (svanimisetti)
@@ -39,9 +44,9 @@ Notes on using TCA9548A I2C Multiplexer:
3944### Installation
4045``` bash
4146# Python2
42- pip2 install git+https://github.com/grantramsay /VL53L0X_rasp_python.git
47+ pip2 install git+https://github.com/naisy /VL53L0X_rasp_python.git
4348# Python3
44- pip3 install git+https://github.com/grantramsay /VL53L0X_rasp_python.git
49+ pip3 install git+https://github.com/naisy /VL53L0X_rasp_python.git
4550```
4651
4752### Compilation
@@ -54,7 +59,7 @@ sudo apt-get install build-essential python-dev
5459Then use following commands to clone the repository and compile:
5560``` bash
5661cd your_git_directory
57- git clone https://github.com/johnbryanmoore /VL53L0X_rasp_python.git
62+ git clone https://github.com/naisy /VL53L0X_rasp_python.git
5863cd VL53L0X_rasp_python
5964make
6065```
Original file line number Diff line number Diff line change @@ -204,6 +204,11 @@ def clear_interrupt(self):
204204 raise Vl53l0xError ('Error clearing VL53L0X interrupt' )
205205
206206 def change_address (self , new_address ):
207+ if self ._dev is not None :
208+ raise Vl53l0xError ('Error changing VL53L0X address' )
209+
210+ self ._i2c .open (bus = self ._i2c_bus )
211+
207212 if new_address == None :
208213 return
209214 elif new_address == self .i2c_address :
@@ -221,3 +226,5 @@ def change_address(self, new_address):
221226 self ._i2c .write_byte_data (self .i2c_address , self .ADDR_I2C_SEC_ADDR , new_address )
222227
223228 self .i2c_address = new_address
229+
230+ self ._i2c .close ()
Original file line number Diff line number Diff line change 2727
2828# Create a VL53L0X object
2929tof = VL53L0X .VL53L0X (i2c_bus = 1 ,i2c_address = 0x29 )
30+ # I2C Address can change before tof.open()
31+ # tof.change_address(0x32)
3032tof .open ()
3133# Start ranging
3234tof .start_ranging (VL53L0X .Vl53l0xAccuracyMode .BETTER )
You can’t perform that action at this time.
0 commit comments