MengLi Shih
/
1_3_Switch_Button
lab1_3
Revision 0:f1f850c06c1a, committed 2017-02-26
- Comitter:
- shih775007
- Date:
- Sun Feb 26 08:46:05 2017 +0000
- Commit message:
- lab1_3
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Feb 26 08:46:05 2017 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" + +DigitalIn Switch(SW2); +DigitalOut redLED(LED1); +DigitalOut greenLED(LED2); + +int main(){ + while(1){ + if( Switch==1 ){ + greenLED = 0; + redLED = 1; + } + else{ + redLED = 0; + greenLED = 1; + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Feb 26 08:46:05 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/ef9c61f8c49f \ No newline at end of file