Median of 3 filter for multiple time of flight sensors translated from arduino by pololu
Dependents: wheelchaircontrol wheelchaircontrol2 wheelchaircontrol3 wheelchaircontrol4 ... more
main.cpp@0:617f20c6b21d, 2018-08-09 (annotated)
- Committer:
- jvfausto
- Date:
- Thu Aug 09 22:06:49 2018 +0000
- Revision:
- 0:617f20c6b21d
- Child:
- 1:0038ad0a63af
Filtered VL53L1X data
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jvfausto | 0:617f20c6b21d | 1 | #include "mbed.h" |
jvfausto | 0:617f20c6b21d | 2 | #include "VL53L1X.h" |
jvfausto | 0:617f20c6b21d | 3 | |
jvfausto | 0:617f20c6b21d | 4 | Serial pc(USBTX,USBRX); |
jvfausto | 0:617f20c6b21d | 5 | bool s1_init = false; |
jvfausto | 0:617f20c6b21d | 6 | bool s2_init = false; |
jvfausto | 0:617f20c6b21d | 7 | bool s3_init = false; |
jvfausto | 0:617f20c6b21d | 8 | bool s4_init = false; |
jvfausto | 0:617f20c6b21d | 9 | VL53L1X sensor1(D14, D15, D0); |
jvfausto | 0:617f20c6b21d | 10 | VL53L1X sensor2(D14, D15, D1); |
jvfausto | 0:617f20c6b21d | 11 | VL53L1X sensor3(D14, D15, D2); |
jvfausto | 0:617f20c6b21d | 12 | VL53L1X sensor4(D14, D15, D3); |
jvfausto | 0:617f20c6b21d | 13 | |
jvfausto | 0:617f20c6b21d | 14 | int main() |
jvfausto | 0:617f20c6b21d | 15 | { |
jvfausto | 0:617f20c6b21d | 16 | sensor1.initReading(0x25,50000); |
jvfausto | 0:617f20c6b21d | 17 | sensor2.initReading(0x27,50000); |
jvfausto | 0:617f20c6b21d | 18 | sensor3.initReading(0x35,50000); |
jvfausto | 0:617f20c6b21d | 19 | sensor4.initReading(0x37,50000); |
jvfausto | 0:617f20c6b21d | 20 | |
jvfausto | 0:617f20c6b21d | 21 | while(1) |
jvfausto | 0:617f20c6b21d | 22 | { |
jvfausto | 0:617f20c6b21d | 23 | pc.printf("%d, ", sensor1.readFromOneSensor()); |
jvfausto | 0:617f20c6b21d | 24 | pc.printf("%d, ", sensor2.readFromOneSensor()); |
jvfausto | 0:617f20c6b21d | 25 | pc.printf("%d, ", sensor3.readFromOneSensor()); |
jvfausto | 0:617f20c6b21d | 26 | pc.printf("%d\r\n", sensor4.readFromOneSensor()); |
jvfausto | 0:617f20c6b21d | 27 | } |
jvfausto | 0:617f20c6b21d | 28 | } |