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
utility.cpp
00001 /****************************************************************************** 00002 * EECS 397 00003 * 00004 * Assignment Name: Lab 6: WaG 00005 * 00006 * Authors: Sam Morrison and Phong Nguyen 00007 * File name: utility.cpp 00008 * Purpose: Utility functions 00009 * 00010 * Created: 03/20/2018 00011 * Last Modified: 03/20/2018 00012 * 00013 ******************************************************************************/ 00014 00015 #include "mbed.h" 00016 #include "io_pins.h" 00017 #include "utility.h" 00018 #include <stdlib.h> 00019 #include <stdio.h> 00020 #include <string.h> 00021 00022 extern DigitalIn start_button; 00023 00024 /* 00025 * int uti_chk_ubutton(); 00026 * Description: returns true when button is pressed and released 00027 * 00028 * Inputs: 00029 * Parameters: 00030 * Globals: 00031 * 00032 * Outputs: 00033 * Returns: void 00034 */ 00035 int uti_chk_ubutton() { 00036 if (start_button == 0) 00037 return 0; // exits if button is not pressed 00038 else { 00039 //cycle until button is released 00040 do { 00041 wait(0.02); 00042 } while (start_button == 1); 00043 wait(0.02); //delay to prevent debounce 00044 return 1; 00045 } 00046 }
Generated on Mon Jul 18 2022 00:36:30 by
