Hello,
for my project I try to retrieve two different distance measurements in order to compare them in real time, for that I use two VL6180X optical sensor using an I2C communication. I did my program and I can not display the values of the two sensors, only one sensor displays the variation of this distance. I have a problem with addressing and I can not find the error.
the code to associate is:
bonjour,
pour mon projet j'essais de récupéré deux mesures de distance différente afin de les comparés en temps réel, pour cela j'utilise deux capteur optique VL6180X utilisant une communication I2C. j'ai fait mon programme et je n'arrive pas à afficher les valeurs des deux capteurs, seulement un capteur affiche la variation de ca distance. j'ai un problème concernant l'adressage et je n'arrive pas as trouver l'erreur.
le code associer est:
#include <Wire.h>
#include <VL6180X.h>
#define ADRESSE1 0x29
#define ADRESSE2 0x52
VL6180X sensor1;
VL6180X sensor2;
void setup()
{
Serial.begin(9600);
Wire.begin();
sensor1.init();
sensor2.init();
sensor1.configureDefault();
sensor2.configureDefault();
sensor1.setAddress(ADRESSE1);
sensor2.setAddress(ADRESSE2);
//sensor1.setScaling(SCALING);
//sensor2.setScaling(SCALING);
sensor1.setTimeout(500);
sensor2.setTimeout(500);
}
void loop()
{
Serial.print(sensor1.readRangeSingle());
Serial.print(" mm\t\t");
Serial.print(sensor2.readRangeSingle());
Serial.print(" mm");
Serial.println();
}