Jesus Fausto / Mbed 2 deprecated VL53L1X_Multiple

Dependencies:   mbed

Fork of VL53L1X_Pololu by Jesus Fausto

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "VL53L1X.h"
00003 
00004 Serial pc(USBTX,USBRX);
00005 bool s1_init = false;
00006 bool s2_init = false;
00007 bool s3_init = false;
00008 bool s4_init = false;
00009 VL53L1X sensor1(D14, D15, D0);
00010 VL53L1X sensor2(D14, D15, D1);
00011 VL53L1X sensor3(D14, D15, D2);
00012 VL53L1X sensor4(D14, D15, D3);
00013 
00014 int main()
00015 {  
00016     sensor1.initReading(0x25,50000);
00017     sensor2.initReading(0x27,50000);
00018     sensor3.initReading(0x35,50000);
00019     sensor4.initReading(0x37,50000);
00020 
00021     while(1)
00022     {
00023       pc.printf("%d, ", sensor1.readFromOneSensor());
00024       pc.printf("%d, ", sensor2.readFromOneSensor());
00025       pc.printf("%d, ", sensor3.readFromOneSensor());
00026       pc.printf("%d\r\n", sensor4.readFromOneSensor()); 
00027     }
00028 }