Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
# Example
include the mbed library with this snippet
#include "mbed.h"
#include "TI_VL53L0X.h"
DigitalOut led1(LED1);
DigitalIn button(p11);
TI_VL53L0X vl53l0x;
int main() {
led1 = 0;
vl53l0x.setup();
vl53l0x.calibration();
while (true) {
if (led1) {
int averageRange = vl53l0x.getMeasurement();
if (9999 != averageRange) {
printf("VL53L0X measurement average %d\n", averageRange);
if (averageRange > 300) {
led1 = 0;
} else {
led1 = 1;
}
}
}
if (button) {
printf("Button Pressed\n\r");
wait(0.7);
led1 = !led1;
if (led1) {
vl53l0x.startMeasurement();
} else {
vl53l0x.stopMeasurement();
}
}
}
}