GroupA / Mbed 2 deprecated WaG_final

Dependencies:   mbed

Fork of Lab_6_WaG by GroupA

wag.cpp

Committer:
spm71
Date:
2018-04-12
Revision:
58:69f9a4607a16
Parent:
57:aef01bd9b3be
Child:
60:604c10531f58

File content as of revision 58:69f9a4607a16:

/******************************************************************************
* EECS 397
*
* Assignment Name: Lab 7: WaG
* 
* Authors: Sam Morrison and Phong Nguyen 
* File name: wag.cpp
* Purpose: Wag functions
*
* Created: 04/12/2018
* Last Modified: 04/12/2018
*
******************************************************************************/

#include "mbed.h"
#include "io_pins.h"
#include "wag.h"
#include <stdlib.h>
#include <stdio.h>
#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)
    }
    
}