Peng Jing Xuan
/
VL53L1X-MAX
VL53L1X-MAX
Diff: main.cpp
- Revision:
- 0:385e286b830a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Oct 22 05:47:05 2019 +0000 @@ -0,0 +1,31 @@ + +#include "mbed.h" +#include "VL53L1X.h" +#include <string> + +Serial pc(USBTX,USBRX); +bool s1_init = true; + +//VL53L1X sensor1(PC_1,PC_0);//VL53L1X(PinName SDA, PinName SCL); +//VL53L1X sensor1(PC_1,PC_0);//VL53L1X(PinName SDA, PinName SCL); +//VL53L1X sensor1(PB_9,PB_8); +//VL53L1X sensor1(P0_04,P0_05); + +VL53L1X sensor1(P3_4,P3_5); +int main() +{ + + pc.baud (115200) ; + s1_init = sensor1.begin(); + + while(1) + { + //pc.printf("test\n\r"); + //pc.printf("\rone.%d\n\r", s1_init); + + printf("%u\n", (unsigned int)sensor1.getDistance()); + wait(0.1); + + } +} +