Median of 3 filter for multiple time of flight sensors translated from arduino by pololu

Dependencies:   mbed

Dependents:   wheelchaircontrol wheelchaircontrol2 wheelchaircontrol3 wheelchaircontrol4 ... more

Committer:
jvfausto
Date:
Wed Jun 03 20:11:31 2020 +0000
Revision:
5:a75d46c735c7
Parent:
4:f6f0c2b9120a
Update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jvfausto 0:617f20c6b21d 1 #include "mbed.h"
jvfausto 0:617f20c6b21d 2 #include "VL53L1X.h"
jvfausto 0:617f20c6b21d 3
jvfausto 4:f6f0c2b9120a 4 Serial pc(USBTX,USBRX);
jvfausto 5:a75d46c735c7 5 VL53L1X sensor1(PD_13, PD_12, PA_15); // Block 1
jvfausto 5:a75d46c735c7 6 VL53L1X sensor2(PD_13, PD_12, PC_7);
jvfausto 5:a75d46c735c7 7 VL53L1X sensor3(PD_13, PD_12, PB_5);
jvfausto 1:0038ad0a63af 8
jvfausto 5:a75d46c735c7 9 VL53L1X sensor4(PD_13, PD_12, PE_11); // Block 2
jvfausto 5:a75d46c735c7 10 VL53L1X sensor5(PD_13, PD_12, PF_14);
jvfausto 5:a75d46c735c7 11 VL53L1X sensor6(PD_13, PD_12, PE_13);
jvfausto 5:a75d46c735c7 12
jvfausto 5:a75d46c735c7 13 VL53L1X sensor7(PD_13, PD_12, PG_15); // Block 3
jvfausto 5:a75d46c735c7 14 VL53L1X sensor8(PD_13, PD_12, PG_14);
jvfausto 5:a75d46c735c7 15 VL53L1X sensor9(PD_13, PD_12, PG_9);
jvfausto 5:a75d46c735c7 16
jvfausto 5:a75d46c735c7 17 VL53L1X sensor10(PD_13, PD_12, PE_10); // Block 4
jvfausto 5:a75d46c735c7 18 VL53L1X sensor11(PD_13, PD_12, PE_12);
jvfausto 5:a75d46c735c7 19 VL53L1X sensor12(PD_13, PD_12, PE_14);
jvfausto 0:617f20c6b21d 20 int main()
jvfausto 0:617f20c6b21d 21 {
jvfausto 5:a75d46c735c7 22 sensor1.initReading(0x27,50000);
jvfausto 4:f6f0c2b9120a 23 sensor2.initReading(0x35,50000);
jvfausto 4:f6f0c2b9120a 24 sensor3.initReading(0x37,50000);
jvfausto 5:a75d46c735c7 25 sensor4.initReading(0x39,50000);
jvfausto 5:a75d46c735c7 26 sensor5.initReading(0x41,50000);
jvfausto 5:a75d46c735c7 27 sensor6.initReading(0x43,50000);
jvfausto 5:a75d46c735c7 28 sensor7.initReading(0x45,50000);
jvfausto 5:a75d46c735c7 29 sensor8.initReading(0x47,50000);
jvfausto 5:a75d46c735c7 30 sensor9.initReading(0x49,50000);
jvfausto 5:a75d46c735c7 31 sensor10.initReading(0x51,50000);
jvfausto 5:a75d46c735c7 32 sensor11.initReading(0x53,50000);
jvfausto 5:a75d46c735c7 33 sensor12.initReading(0x55,50000);
jvfausto 0:617f20c6b21d 34 while(1)
jvfausto 0:617f20c6b21d 35 {
jvfausto 4:f6f0c2b9120a 36 pc.printf("%d, ", sensor1.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 37 pc.printf("%d, ", sensor2.readFromOneSensor());
jvfausto 5:a75d46c735c7 38 pc.printf("%d, ", sensor3.readFromOneSensor());
jvfausto 5:a75d46c735c7 39 pc.printf("%d, ", sensor4.readFromOneSensor());
jvfausto 5:a75d46c735c7 40 pc.printf("%d, ", sensor5.readFromOneSensor());
jvfausto 5:a75d46c735c7 41 pc.printf("%d, ", sensor6.readFromOneSensor());
jvfausto 5:a75d46c735c7 42 pc.printf("%d, ", sensor7.readFromOneSensor());
jvfausto 5:a75d46c735c7 43 pc.printf("%d, ", sensor8.readFromOneSensor());
jvfausto 5:a75d46c735c7 44 pc.printf("%d, ", sensor9.readFromOneSensor());
jvfausto 5:a75d46c735c7 45 pc.printf("%d, ", sensor10.readFromOneSensor());
jvfausto 5:a75d46c735c7 46 pc.printf("%d, ", sensor11.readFromOneSensor());
jvfausto 5:a75d46c735c7 47 pc.printf("%d, ", sensor12.readFromOneSensor());
jvfausto 1:0038ad0a63af 48 pc.printf("\r\n");
jvfausto 4:f6f0c2b9120a 49 /*
jvfausto 4:f6f0c2b9120a 50 pc.printf("%d hello\r\n", frontRight.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 51 pc.printf("%d hello\r\n", frontRight2.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 52 pc.printf("%d hello\r\n", frontRight3.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 53 pc.printf("%d hello\r\n", frontRight4.readFromOneSensor()); */
jvfausto 0:617f20c6b21d 54 }
jvfausto 5:a75d46c735c7 55 }