GroupA / Mbed 2 deprecated WaG_final

Dependencies:   mbed

Fork of Lab_6_WaG by GroupA

Revision:
23:3da1d39c1ae9
Child:
26:58befaac9643
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/utility.cpp	Tue Mar 20 15:40:03 2018 +0000
@@ -0,0 +1,34 @@
+/******************************************************************************
+* 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 {
+        while (my_button == 1) { //cycle until button is released
+                wait(0.02); //20 ms
+        }
+        wait(0.02); //delay to prevent debounce
+        return 1;
+    }
+}
\ No newline at end of file