Part1
Dependencies: mbed
main.cpp
- Committer:
- jaredwil
- Date:
- 2015-02-08
- Revision:
- 4:0eaf5cd27462
- Parent:
- 3:e2894353eac5
File content as of revision 4:0eaf5cd27462:
#include "mbed.h" #include "math.h" //Initialize Digital I/O DigitalOut myled1(LED1); DigitalOut myled2(LED2); 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); } wait(0.1); } } //Toggle function switch the state of the led called by function void toggle(DigitalOut led) { led =! led; }