adafruit / Adafruit_VL53L0X

Arduino library for Adafruit VL53L0X
149 stars 118 forks source link

Adding simple support for continuous recording. #19

Closed dcliftreaves closed 2 years ago

dcliftreaves commented 5 years ago

Continuous reading makes a big difference in latency when reading from N devices. It is the difference of something like 33ms per read to basically instant. (Instant because you are always burning power and reading asynchronously to the main MCU and the MCU just picks up whatever was the last reading from the VL53L0X device.)

ladyada commented 5 years ago

thanks! i think maybe better to have a function like setContinuous() that you can set true/false to change between triggered and continous? i think that may be a common scenario. would you be up to switching the code up a bit?

dcliftreaves commented 5 years ago

I have done what you have asked for but haven't done extensive testing on it like I had with the previous code.

ladyada commented 5 years ago

thank you! next time we do a 'sweep' of this lirbary we'll pick up and test the PR :)

caternuson commented 2 years ago

How about providing this by using the existing method:

  boolean startRangeContinuous(uint16_t period_ms = 50);

and enabling it when period_ms is passed in as 0 ?

And to be clear, the goal here is to provide ability to set read mode to one shown in rectangle? image

caternuson commented 2 years ago

See new example: https://github.com/adafruit/Adafruit_VL53L0X/blob/master/examples/vl53l0x_continuous/vl53l0x_continuous.ino