GroupA / Mbed 2 deprecated WaG_final

Dependencies:   mbed

Fork of Lab_6_WaG by GroupA

utility.cpp

Committer:
spm71
Date:
2018-03-22
Revision:
26:58befaac9643
Parent:
23:3da1d39c1ae9
Child:
31:0dc2b4a3eee6

File content as of revision 26:58befaac9643:

/******************************************************************************
* EECS 397
*
* Assignment Name: Lab 6: WaG
* 
* Authors: Sam Morrison and Phong Nguyen 
* File name: utility.cpp
* Purpose: Utility functions
*
* Created: 03/20/2018
* Last Modified: 03/20/2018
*
******************************************************************************/

#include "mbed.h"
#include "io_pins.h"
#include "utility.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

extern DigitalIn my_button;

int uti_chk_ubutton() {
    if (my_button == 0)
        return 0; // exits if button is not pressed
    else {
        //cycle until button is released
        do { 
        wait(0.02); 
        } while (my_button == 1) 
        wait(0.02); //delay to prevent debounce
        return 1;
    }
}