Peng Jing Xuan / Mbed OS VL53L1X-MAX
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "mbed.h"
00003 #include "VL53L1X.h"
00004 #include <string> 
00005 
00006 Serial pc(USBTX,USBRX);
00007 bool s1_init = true;
00008 
00009 //VL53L1X sensor1(PC_1,PC_0);//VL53L1X(PinName SDA, PinName SCL);
00010 //VL53L1X sensor1(PC_1,PC_0);//VL53L1X(PinName SDA, PinName SCL);
00011 //VL53L1X sensor1(PB_9,PB_8);
00012 //VL53L1X sensor1(P0_04,P0_05);
00013 
00014 VL53L1X sensor1(P3_4,P3_5);
00015 int main()
00016 {  
00017     
00018     pc.baud (115200) ;
00019     s1_init = sensor1.begin();
00020        
00021     while(1)
00022     {         
00023       //pc.printf("test\n\r");
00024      //pc.printf("\rone.%d\n\r", s1_init);
00025      
00026      printf("%u\n", (unsigned int)sensor1.getDistance());
00027      wait(0.1);    
00028                
00029     }
00030 }
00031