Lab that has to do with basic IO on mbed.
Dependencies: DebounceIn mbed PinDetect
JessesLab1/main.cpp@33:275385014ba9, 2016-01-15 (annotated)
- Committer:
- gtzintzarov3
- Date:
- Fri Jan 15 20:10:15 2016 +0000
- Revision:
- 33:275385014ba9
- Child:
- 34:2749d3f57060
GT: reworked some of the file structure
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gtzintzarov3 | 33:275385014ba9 | 1 | #include "mbed.h" |
gtzintzarov3 | 33:275385014ba9 | 2 | #include "DebounceIn.h" |
gtzintzarov3 | 33:275385014ba9 | 3 | |
gtzintzarov3 | 33:275385014ba9 | 4 | |
gtzintzarov3 | 33:275385014ba9 | 5 | DebounceIn pb(p8); |
gtzintzarov3 | 33:275385014ba9 | 6 | DigitalIn pb(p8); |
gtzintzarov3 | 33:275385014ba9 | 7 | DigitalOut led(LED1); |
gtzintzarov3 | 33:275385014ba9 | 8 | |
gtzintzarov3 | 33:275385014ba9 | 9 | int main() { |
gtzintzarov3 | 33:275385014ba9 | 10 | |
gtzintzarov3 | 33:275385014ba9 | 11 | while(1) { |
gtzintzarov3 | 33:275385014ba9 | 12 | while(1) { |
gtzintzarov3 | 33:275385014ba9 | 13 | |
gtzintzarov3 | 33:275385014ba9 | 14 | if(!pb) { |
gtzintzarov3 | 33:275385014ba9 | 15 | if(pb) { |
gtzintzarov3 | 33:275385014ba9 | 16 | |
gtzintzarov3 | 33:275385014ba9 | 17 | led = !pb; |
gtzintzarov3 | 33:275385014ba9 | 18 | led = !led; |
gtzintzarov3 | 33:275385014ba9 | 19 | |
gtzintzarov3 | 33:275385014ba9 | 20 | } |
gtzintzarov3 | 33:275385014ba9 | 21 | wait(0.25); |
gtzintzarov3 | 33:275385014ba9 | 22 | } |
gtzintzarov3 | 33:275385014ba9 | 23 | else{ |
gtzintzarov3 | 33:275385014ba9 | 24 | |
gtzintzarov3 | 33:275385014ba9 | 25 | led = 0; |
gtzintzarov3 | 33:275385014ba9 | 26 | } |
gtzintzarov3 | 33:275385014ba9 | 27 | } |
gtzintzarov3 | 33:275385014ba9 | 28 | |
gtzintzarov3 | 33:275385014ba9 | 29 | } |