Multiple Distance Sensors Python

distancesensor
gopigo3

#1

We would like to have a distance sensor on two or more sides of a gopigo3. We have Python code for one sensor working. Not sure if possible to read the distance of a second distance sensor. Here is our code so far.

import time
import sys #used for closing the running program
import easygopigo3 as easy
gpg = easy.EasyGoPiGo3()
dist = gpg.init_distance_sensor()
while True:
print dist.read_mm()


#2

Hi @jhutton,

It’s possible to have up to 3 distance sensors connected to the GoPiGo3, but bear in mind that each sensor has to be connected to its own bus. And because the GoPiGo3 has 3 buses (GPG3_AD1, GPG3_AD2, RPI_1) there can be up to 3 distance sensors connected.

Please read the following section from our documentation to get a better understanding:
http://di-sensors.readthedocs.io/en/latest/structure.html#hardware-interface

Thank you!