Peng Jing Xuan
/
VL53L1X-MAX
VL53L1X-MAX
main.cpp@0:385e286b830a, 2019-10-22 (annotated)
- Committer:
- peng103617
- Date:
- Tue Oct 22 05:47:05 2019 +0000
- Revision:
- 0:385e286b830a
MAX
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
peng103617 | 0:385e286b830a | 1 | |
peng103617 | 0:385e286b830a | 2 | #include "mbed.h" |
peng103617 | 0:385e286b830a | 3 | #include "VL53L1X.h" |
peng103617 | 0:385e286b830a | 4 | #include <string> |
peng103617 | 0:385e286b830a | 5 | |
peng103617 | 0:385e286b830a | 6 | Serial pc(USBTX,USBRX); |
peng103617 | 0:385e286b830a | 7 | bool s1_init = true; |
peng103617 | 0:385e286b830a | 8 | |
peng103617 | 0:385e286b830a | 9 | //VL53L1X sensor1(PC_1,PC_0);//VL53L1X(PinName SDA, PinName SCL); |
peng103617 | 0:385e286b830a | 10 | //VL53L1X sensor1(PC_1,PC_0);//VL53L1X(PinName SDA, PinName SCL); |
peng103617 | 0:385e286b830a | 11 | //VL53L1X sensor1(PB_9,PB_8); |
peng103617 | 0:385e286b830a | 12 | //VL53L1X sensor1(P0_04,P0_05); |
peng103617 | 0:385e286b830a | 13 | |
peng103617 | 0:385e286b830a | 14 | VL53L1X sensor1(P3_4,P3_5); |
peng103617 | 0:385e286b830a | 15 | int main() |
peng103617 | 0:385e286b830a | 16 | { |
peng103617 | 0:385e286b830a | 17 | |
peng103617 | 0:385e286b830a | 18 | pc.baud (115200) ; |
peng103617 | 0:385e286b830a | 19 | s1_init = sensor1.begin(); |
peng103617 | 0:385e286b830a | 20 | |
peng103617 | 0:385e286b830a | 21 | while(1) |
peng103617 | 0:385e286b830a | 22 | { |
peng103617 | 0:385e286b830a | 23 | //pc.printf("test\n\r"); |
peng103617 | 0:385e286b830a | 24 | //pc.printf("\rone.%d\n\r", s1_init); |
peng103617 | 0:385e286b830a | 25 | |
peng103617 | 0:385e286b830a | 26 | printf("%u\n", (unsigned int)sensor1.getDistance()); |
peng103617 | 0:385e286b830a | 27 | wait(0.1); |
peng103617 | 0:385e286b830a | 28 | |
peng103617 | 0:385e286b830a | 29 | } |
peng103617 | 0:385e286b830a | 30 | } |
peng103617 | 0:385e286b830a | 31 |