Hi,
I'm trying to detect distance fro object using VL53L1X sensor.
Sensor is connected with 5 pins:
-VCC,GND,SDA,SCL,XSHUT
I'm using VL53L1X pololu library.
I am able to initialize sensor and start measuring distance.
I'm able to put it to SW standby with sensor.stopContinuous()
and wake it up to sensor.startContinuous()
.
And eveyrthing works fine - results are correct.
However I would like to put it into HW standby by setting XSHUT to LOW.
But I'm unable to wake it up.
After waking up - sensor.read()
returns only 0.
What am I doing wrong?
Please check my simple snippet:
#include <VL53L1X.h>
VL53L1X sensor;
#define XSHUT 4
void setup() {
Serial.begin(9600);
Wire.begin();
Wire.setClock(400000);
pinMode(XSHUT , OUTPUT);
digitalWrite(XSHUT, LOW);
///INIT SENSOR
delay(50);
digitalWrite(XSHUT, HIGH);
delay(50);
sensor.setTimeout(500);
if (!sensor.init())
{
Serial.print(XSHUT);
Serial.println(F(" - is not responding!"));
}
else
{
sensor.setAddress(0x30);
sensor.setDistanceMode(VL53L1X::Short);
sensor.setMeasurementTimingBudget(50000);
sensor.startContinuous(45);
}
delay(50);
Serial.println(sensor.read()); //CORRECT READOUTS
delay(1000);
Serial.println(sensor.read());
delay(1000);
Serial.println(sensor.read());
delay(1000);
Serial.println(sensor.read());
delay(1000);
Serial.println(sensor.read());
delay(1000);
sensor.stopContinuous();
delay(500);
Serial.println("Stopped scanning");
digitalWrite(XSHUT, LOW);
delay(5000);
digitalWrite(XSHUT, HIGH);
delay(500);
Serial.println("Scanning continues");
sensor.startContinuous(45);
delay(1000);
Serial.println(sensor.read()); //STARTS RETURNING 0
delay(1000);
Serial.println(sensor.read());
delay(1000);
Serial.println(sensor.read());
delay(1000);
Serial.println(sensor.read());
delay(1000);
Serial.println(sensor.read());
delay(1000);
sensor.stopContinuous();
}
void loop() {
}