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@31:0dc2b4a3eee6, 2018-03-22 (annotated)
- Committer:
- spm71
- Date:
- Thu Mar 22 16:06:21 2018 +0000
- Revision:
- 31:0dc2b4a3eee6
- Parent:
- 26:58befaac9643
- Child:
- 35:ad2b3d6f0e5a
Fixed LED display code
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| spm71 | 23:3da1d39c1ae9 | 1 | /****************************************************************************** |
| spm71 | 23:3da1d39c1ae9 | 2 | * EECS 397 |
| spm71 | 23:3da1d39c1ae9 | 3 | * |
| spm71 | 23:3da1d39c1ae9 | 4 | * Assignment Name: Lab 6: WaG |
| spm71 | 23:3da1d39c1ae9 | 5 | * |
| spm71 | 23:3da1d39c1ae9 | 6 | * Authors: Sam Morrison and Phong Nguyen |
| spm71 | 23:3da1d39c1ae9 | 7 | * File name: utility.cpp |
| spm71 | 23:3da1d39c1ae9 | 8 | * Purpose: Utility functions |
| spm71 | 23:3da1d39c1ae9 | 9 | * |
| spm71 | 23:3da1d39c1ae9 | 10 | * Created: 03/20/2018 |
| spm71 | 23:3da1d39c1ae9 | 11 | * Last Modified: 03/20/2018 |
| spm71 | 23:3da1d39c1ae9 | 12 | * |
| spm71 | 23:3da1d39c1ae9 | 13 | ******************************************************************************/ |
| spm71 | 23:3da1d39c1ae9 | 14 | |
| spm71 | 23:3da1d39c1ae9 | 15 | #include "mbed.h" |
| spm71 | 23:3da1d39c1ae9 | 16 | #include "io_pins.h" |
| spm71 | 23:3da1d39c1ae9 | 17 | #include "utility.h" |
| spm71 | 23:3da1d39c1ae9 | 18 | #include <stdlib.h> |
| spm71 | 23:3da1d39c1ae9 | 19 | #include <stdio.h> |
| spm71 | 23:3da1d39c1ae9 | 20 | #include <string.h> |
| spm71 | 23:3da1d39c1ae9 | 21 | |
| spm71 | 23:3da1d39c1ae9 | 22 | extern DigitalIn my_button; |
| spm71 | 23:3da1d39c1ae9 | 23 | |
| spm71 | 23:3da1d39c1ae9 | 24 | int uti_chk_ubutton() { |
| spm71 | 23:3da1d39c1ae9 | 25 | if (my_button == 0) |
| spm71 | 23:3da1d39c1ae9 | 26 | return 0; // exits if button is not pressed |
| spm71 | 23:3da1d39c1ae9 | 27 | else { |
| spm71 | 26:58befaac9643 | 28 | //cycle until button is released |
| spm71 | 26:58befaac9643 | 29 | do { |
| spm71 | 26:58befaac9643 | 30 | wait(0.02); |
| spm71 | 31:0dc2b4a3eee6 | 31 | } while (my_button == 1); |
| spm71 | 23:3da1d39c1ae9 | 32 | wait(0.02); //delay to prevent debounce |
| spm71 | 23:3da1d39c1ae9 | 33 | return 1; |
| spm71 | 23:3da1d39c1ae9 | 34 | } |
| spm71 | 23:3da1d39c1ae9 | 35 | } |
