GroupA / Mbed 2 deprecated WaG_final

Dependencies:   mbed

Fork of Lab_6_WaG by GroupA

Revision:
58:69f9a4607a16
Parent:
57:aef01bd9b3be
Child:
60:604c10531f58
--- a/wag.cpp	Thu Apr 12 15:09:50 2018 +0000
+++ b/wag.cpp	Thu Apr 12 16:12:28 2018 +0000
@@ -17,4 +17,31 @@
 #include "wag.h"
 #include <stdlib.h>
 #include <stdio.h>
-#include <string.h>
\ No newline at end of file
+#include <string.h>
+#include <timer.h>
+
+void gnoll() {
+    int hit, miss;
+    int a_num;
+    int led_command;
+    int sensor_no = 0 //change to match station
+    
+    for (int i = 0; i < 15; i++) {
+        a_num = rand() % 8;
+        turn_to_target(stp_sensor_pos[a_num]);
+        lzr_on();
+        wait(LASER_DELAY);
+        if (sensor_values[sensor_no + a_num] > PTHRESH) {
+            led_command = 0x0500 + a_num;
+            spi_send(as1107, led_command);
+        }
+        
+        clock_t start = clock();
+        clock_t finish = clock();
+        do {
+            // check for whacker sensors
+            finish = clock();
+        } while (finish - start < VOLLEY_DELAY)
+    }
+    
+}
\ No newline at end of file