4p78-final-project/robot/distance.h

20 lines
354 B
C

#include "Adafruit_VL53L0X.h"
Adafruit_VL53L0X lox = Adafruit_VL53L0X();
void initDistance(){
if (!lox.begin()) {
Serial.println(F("Failed to boot VL53L0X"));
while(1);
}
lox.startRangeContinuous();
}
void updateDistance(){
if (lox.isRangeComplete()) {
Serial.print("Distance in mm: ");
Serial.println(lox.readRange());
}
}