Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of WaG by
Diff: main.cpp
- Revision:
- 52:8987e38851e5
- Parent:
- 51:1eb60f0d2f03
- Child:
- 53:389fe53b2642
--- a/main.cpp Tue Apr 03 20:51:20 2018 +0000 +++ b/main.cpp Tue Apr 03 22:32:41 2018 +0000 @@ -39,6 +39,7 @@ int station = -1; int *cal_status = NOT_CALIBRATED; float sensor_values[TGT_SENSOR_QUAN * 2]; +int stp_sensor_pos[TGT_SENSOR_QUAN]; struct spi_cfg as1107{ SPI_AS1107_ID, @@ -87,7 +88,42 @@ // determine if the wag is connected to station A or station B station = station_select.read(); - pc.printf("test part 9 begin\n"); + /** Part 9: calibration test **/ + pc.printf("Part 9: calibration test begin.\n"); stp_calibrate(station, sensor_values, cal_status); - pc.printf("test part 9 done\n"); + pc.printf("Part 9: calibration test done.\n"); + + /** Part 10: repeatibility test **/ + pc.printf("Part 10: press user button to begin the test.\n"); + while (uti_chk_ubutton() == 0); + while (uti_chk_ubutton() == 0) { + int sensor_no = 0; + if (station == STATION_B) sensor_no = 8; + + // move to the left most sensor + repeatability_test(stp_sensor_pos[sensor_no], *cal_status); + // turn on laser + lzr_on(); + // read sensor value + ana_scan_mux(sensor_values, TGT_SENSOR_QUAN * 2); + // turn off laser + lzr_off(); + // print value + pc.printf("Sensor %d: %f\n", sensor_no, sensor_values[sensor_no]); + + // move to the right most sensor + repeatability_test(stp_sensor_pos[sensor_no + TGT_SENSOR_QUAN - 1], *cal_status); + // turn on laser + lzr_on(); + // read sensor value + ana_scan_mux(sensor_values, TGT_SENSOR_QUAN * 2); + // turn off laser + lzr_off(); + // print value + pc.printf("Sensor %d: %f\n", sensor_no, sensor_values[sensor_no]); + + // move to the left most sensor + repeatability_test(stp_sensor_pos[sensor_no], *cal_status); + } + pc.printf("Part 10: repeatibility test done.\n"); } \ No newline at end of file