Dependencies: mbed
Revision 4:0eaf5cd27462, committed 2015-02-08
- Comitter:
- jaredwil
- Date:
- Sun Feb 08 15:22:19 2015 +0000
- Parent:
- 3:e2894353eac5
- Commit message:
- commented;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e2894353eac5 -r 0eaf5cd27462 main.cpp --- a/main.cpp Thu Jan 29 20:44:17 2015 +0000 +++ b/main.cpp Sun Feb 08 15:22:19 2015 +0000 @@ -1,20 +1,26 @@ #include "mbed.h" #include "math.h" + +//Initialize Digital I/O DigitalOut myled1(LED1); DigitalOut myled2(LED2); -DigitalIn pound(p25); //Not sure if this will work labled (analog input) -DigitalIn two(p23); //^ +DigitalIn pound(p25); +DigitalIn two(p23); +//Initialize Toggle Function void toggle(DigitalOut led); int main() { + //Main Loop while(1) { + //Toggle LED1 if pound is pressed if(pound == 1) { toggle(myled1); } + //Toggle LED2 if #2 is pressed if(two == 1) { toggle(myled2); @@ -23,6 +29,7 @@ } } +//Toggle function switch the state of the led called by function void toggle(DigitalOut led) { led =! led;