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 Lab_6_WaG by
Diff: wag.cpp
- Revision:
- 78:84ce90a76594
- Parent:
- 76:7514ca07b45d
--- a/wag.cpp Thu Apr 26 16:12:09 2018 +0000 +++ b/wag.cpp Fri Apr 27 20:14:21 2018 +0000 @@ -73,6 +73,7 @@ //pc.printf("led_command: %d\n", led_command); spi_send(as1107, led_command); // light up LED //pc.printf("done sent\n"); + pc.printf("led_command: %d\n", led_command); wait(LED_DELAY); // NOTE: must put a wait() here or else the led won't light up } @@ -99,8 +100,8 @@ if (sensor_values[whacker_no + a_num] * 3.3 > PTTHRESH) { hit++; // increment hit count pc.printf("Hit\n"); - while(sensor_values[whacker_no + a_num] * 3.3 > PTTHRESH) - ana_scan_mux(sensor_values, TGT_SENSOR_QUAN * 2); // waits for whacker laser to turn off + //while(sensor_values[whacker_no + a_num] * 3.3 > PTTHRESH) + // ana_scan_mux(sensor_values, TGT_SENSOR_QUAN * 2); // waits for whacker laser to turn off } else { @@ -185,9 +186,10 @@ while (1); } } - + + pc.printf("stp_sensor_pos: %d\n", stp_sensor_pos[sensor_no + gnoll_sensor_indicator]); // point whack’s laser to the corresponding sensor on whack target array - turn_to_target(stp_sensor_pos[gnoll_no + gnoll_sensor_indicator ]); + turn_to_target(stp_sensor_pos[sensor_no + gnoll_sensor_indicator]); // turn on whacker's laser lzr_on(); @@ -205,7 +207,7 @@ if (sensor_values[i + sensor_no] * 3.3f > PTTHRESH) { sensor_registered = true; whack_sensor_indicator = i; - pc.printf("gnoll_sensor_indicator: %d\n", gnoll_sensor_indicator); + pc.printf("whack_sensor_indicator: %d\n", whack_sensor_indicator); } } @@ -220,7 +222,9 @@ // activate corresponding indicator in whack LED row led_command = 0x0500 + led_values[whack_sensor_indicator]; + pc.printf("led_command: %d\n", led_command); spi_send(as1107, led_command); + wait(LED_DELAY); // waiting for gnoll laser to turn off to turn off do {