Lab 6 code.
Dependencies: mbed
Fork of WaG by
Diff: stepper.cpp
- Revision:
- 55:1a25dd75e309
- Parent:
- 54:d5a95bc8ffb0
- Child:
- 56:048b30c9f2a1
--- a/stepper.cpp Thu Apr 05 20:32:04 2018 +0000 +++ b/stepper.cpp Thu Apr 05 21:16:59 2018 +0000 @@ -211,7 +211,6 @@ pc.printf("step 9 test begin\n"); int sensor_no = 0; - int scanned[8]; if (station == STATION_A) sensor_no = 0; if (station == STATION_B) sensor_no = 0; @@ -243,7 +242,6 @@ for (int j = 0; j < TGT_SENSOR_QUAN; j++) { if (sensor_values[sensor_no + j] * 3.3f > PTTHRESH) { pc.printf("PT %d: %f\n", sensor_no + j, sensor_values[sensor_no + j] * 3.3f); - //scanned[i]++; wait(0.02); } } @@ -285,11 +283,13 @@ void repeatability_test(int sensor_position, int cal_status) { int num_steps = 0; // number of steps the stepper motor needed to move from current position - pc.printf("stp_cur_pos: %d\t stp_sensor_pos[sensor_position]: %d\t sensor_position: %d\n", stp_cur_pos, stp_sensor_pos[sensor_position], sensor_position); - + //pc.printf("stp_cur_pos: %d\t stp_sensor_pos[sensor_position]: %d\t sensor_position: %d\n", stp_cur_pos, stp_sensor_pos[sensor_position], sensor_position); + pc.printf("cal_status: %d\n", cal_status); // if the system is not calibrated - if (cal_status == NOT_CALIBRATED) + if (cal_status == NOT_CALIBRATED) { pc.printf("Error: The system is not calibrated. See repeatibility_test() function .\n"); + while (1); + } else { // if the current position is less than the position of sepcified sensor if (stp_cur_pos < stp_sensor_pos[sensor_position]) {