pololu / vl53l0x-arduino

Pololu Arduino library for VL53L0X time-of-flight distance sensor
https://www.pololu.com/product/2490
Other
345 stars 163 forks source link

Soft reset sensors #30

Closed Lyr3x closed 5 years ago

Lyr3x commented 5 years ago

Whats the correct way to soft reset sensors? I tried to perform the steps which are initially used in the setup() function again but that is not working.

  pinMode(ROOM_XSHUT, OUTPUT);
  pinMode(CORRIDOR_XSHUT, OUTPUT);

  pinMode(ROOM_XSHUT, INPUT);
  wait(10);
  ROOM_SENSOR.setAddress(ROOM_SENSOR_newAddress);
  pinMode(CORRIDOR_XSHUT, INPUT);
  wait(10);
  CORRIDOR_SENSOR.setAddress(CORRIDOR_SENSOR_newAddress);
  ROOM_SENSOR.init();
  CORRIDOR_SENSOR.init();
  ROOM_SENSOR.setTimeout(500);
  CORRIDOR_SENSOR.setTimeout(500);

Background: It happend sometimes that the sensors are getting timeouts or wrong values after a few days. When that is happening i just want to soft reset them instead of power off the whole system.

kevin-pololu commented 5 years ago

That looks like the right way to do it; the only thing I would try adding is digitalWrite(ROOM_XSHUT, LOW); (and same with the other pin) to make sure they are driving low.

If that doesn't help, and you are still looking for assistance, could you please post on our forum? That is a more appropriate place for troubleshooting; the GitHub issues are intended for tracking bugs and feature requests related to the library code. This doesn't currently look like it's related to the library functionality, so I'm going to close this issue for now.