a test program for a distance sensor using a photo reflector. This program calibrate a model of relation between voltage and distance by the spline interpolation.
Dependencies: mbed TRP105F_Spline
main.cpp@0:1fc7ec031057, 2020-10-21 (annotated)
- Committer:
- aktk
- Date:
- Wed Oct 21 17:22:55 2020 +0000
- Revision:
- 0:1fc7ec031057
test program verified
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aktk | 0:1fc7ec031057 | 1 | #include "mbed.h" |
aktk | 0:1fc7ec031057 | 2 | #include "TRP105F_Spline.h" |
aktk | 0:1fc7ec031057 | 3 | |
aktk | 0:1fc7ec031057 | 4 | DigitalOut myled(LED1); |
aktk | 0:1fc7ec031057 | 5 | TRP105FS sensor(3,AsDEBUG); |
aktk | 0:1fc7ec031057 | 6 | |
aktk | 0:1fc7ec031057 | 7 | |
aktk | 0:1fc7ec031057 | 8 | int main() { |
aktk | 0:1fc7ec031057 | 9 | |
aktk | 0:1fc7ec031057 | 10 | sensor.calibrateSensor(); |
aktk | 0:1fc7ec031057 | 11 | sensor.saveSetting("sav.log"); |
aktk | 0:1fc7ec031057 | 12 | |
aktk | 0:1fc7ec031057 | 13 | while(1) { |
aktk | 0:1fc7ec031057 | 14 | myled = 1; |
aktk | 0:1fc7ec031057 | 15 | wait(0.2); |
aktk | 0:1fc7ec031057 | 16 | myled = 0; |
aktk | 0:1fc7ec031057 | 17 | wait(0.2); |
aktk | 0:1fc7ec031057 | 18 | } |
aktk | 0:1fc7ec031057 | 19 | } |