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:
Thu Aug 08 16:15:17 2019 +0000
Revision:
4:f6f0c2b9120a
Parent:
1:0038ad0a63af
Child:
5:a75d46c735c7
Fixing bugs

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 1:0038ad0a63af 5
jvfausto 1:0038ad0a63af 6 VL53L1X sensor1(D4, D5, D6);
jvfausto 4:f6f0c2b9120a 7 VL53L1X sensor2(D4, D5, D7);
jvfausto 4:f6f0c2b9120a 8 VL53L1X sensor3(D4, D5, D8);
jvfausto 4:f6f0c2b9120a 9 VL53L1X sensor4(D4, D5, D9);
jvfausto 4:f6f0c2b9120a 10 /*VL53L1X frontRight(PD_13, PD_12, D3); //(SCL, SDA, shutdown)
jvfausto 4:f6f0c2b9120a 11 VL53L1X frontRight2(PD_13, PD_12, D2); //(SCL, SDA, shutdown)
jvfausto 4:f6f0c2b9120a 12 VL53L1X frontRight3(PD_13, PD_12, D4); //(SCL, SDA, shutdown)
jvfausto 4:f6f0c2b9120a 13 VL53L1X frontRight4(PD_13, PD_12, D5); //(SCL, SDA, shutdown)
jvfausto 4:f6f0c2b9120a 14 */
jvfausto 0:617f20c6b21d 15 int main()
jvfausto 0:617f20c6b21d 16 {
jvfausto 4:f6f0c2b9120a 17 wait(5);
jvfausto 4:f6f0c2b9120a 18
jvfausto 4:f6f0c2b9120a 19 /* frontRight.initReading(0x25,50000);
jvfausto 4:f6f0c2b9120a 20 frontRight2.initReading(0x27,50000);
jvfausto 4:f6f0c2b9120a 21 frontRight3.initReading(0x35,50000);
jvfausto 4:f6f0c2b9120a 22 frontRight4.initReading(0x37,50000);/*
jvfausto 4:f6f0c2b9120a 23 */sensor1.initReading(0x27,50000);
jvfausto 4:f6f0c2b9120a 24 sensor2.initReading(0x35,50000);
jvfausto 4:f6f0c2b9120a 25 sensor3.initReading(0x37,50000);
jvfausto 0:617f20c6b21d 26
jvfausto 0:617f20c6b21d 27 while(1)
jvfausto 0:617f20c6b21d 28 {
jvfausto 4:f6f0c2b9120a 29 pc.printf("%d, ", sensor1.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 30 pc.printf("%d, ", sensor2.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 31 pc.printf("%d, ", sensor3.readFromOneSensor());
jvfausto 1:0038ad0a63af 32 pc.printf("\r\n");
jvfausto 4:f6f0c2b9120a 33 /*
jvfausto 4:f6f0c2b9120a 34 pc.printf("%d hello\r\n", frontRight.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 35 pc.printf("%d hello\r\n", frontRight2.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 36 pc.printf("%d hello\r\n", frontRight3.readFromOneSensor());
jvfausto 4:f6f0c2b9120a 37 pc.printf("%d hello\r\n", frontRight4.readFromOneSensor()); */
jvfausto 0:617f20c6b21d 38 }
jvfausto 0:617f20c6b21d 39 }