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:
- 54:d5a95bc8ffb0
- Parent:
- 53:389fe53b2642
- Child:
- 55:1a25dd75e309
--- a/main.cpp Thu Apr 05 17:16:40 2018 +0000 +++ b/main.cpp Thu Apr 05 20:32:04 2018 +0000 @@ -59,6 +59,7 @@ spi_send(as1107, 0x0300); spi_send(as1107, 0x0400); + /* pc.printf("Press user button to test.\n"); @@ -67,10 +68,10 @@ test_phototransistors(); pc.printf("Phototransistors tested\n"); - + */ step_test(); pc.printf("Step motor tested\n"); - + /* pc.printf("laser test\n"); while (my_button.read() == 0); pc.printf("test begin\n"); @@ -88,12 +89,27 @@ // determine if the wag is connected to station A or station B station = station_select.read(); pc.printf("station in main: %d\n", station); - + */ /** Part 9: calibration test **/ pc.printf("Part 9: calibration test begin.\n"); stp_calibrate(station, sensor_values, cal_status); pc.printf("Part 9: calibration test done.\n"); + + // stp_sensor_pos[0] = 27; + //stp_sensor_pos[1] = 50; + //stp_sensor_pos[2] = 72; + //stp_sensor_pos[3] = 98; + //stp_sensor_pos[4] = 122; + //stp_sensor_pos[5] = 146; + //stp_sensor_pos[6] = 173; + //stp_sensor_pos[7] = 197; + + stp_find_home(); + + // turn on laser + lzr_on(); + /** Part 10: repeatibility test **/ pc.printf("Part 10: press user button to begin the test.\n"); while (uti_chk_ubutton() == 0); @@ -102,29 +118,22 @@ 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(); + repeatability_test(0, *cal_status); + // 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]); + pc.printf("Sensor %d: %f\n", sensor_no, sensor_values[sensor_no] * 3.3f); // move to the right most sensor - repeatability_test(stp_sensor_pos[sensor_no + TGT_SENSOR_QUAN - 1], *cal_status); - // turn on laser - lzr_on(); + repeatability_test(TGT_SENSOR_QUAN - 1, *cal_status); + // 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("Sensor %d: %f\n", sensor_no + TGT_SENSOR_QUAN, sensor_values[sensor_no + TGT_SENSOR_QUAN - 1] * 3.3f); } pc.printf("Part 10: repeatibility test done.\n"); } \ No newline at end of file