Jack Occleshaw
/
w1squarewave
w1squarewave
Revision 0:e556da5831a8, committed 2017-01-12
- Comitter:
- occle
- Date:
- Thu Jan 12 15:41:24 2017 +0000
- Commit message:
- w1squarewave
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 |
diff -r 000000000000 -r e556da5831a8 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jan 12 15:41:24 2017 +0000 @@ -0,0 +1,25 @@ + +#include "mbed.h" +DigitalOut redled(LED_RED); +DigitalOut greenled(LED_GREEN); +DigitalIn switchinput(SW2); + +int main() { + while(1) { + if (switchinput==0) { //test value of switchinput +//execute following block if switchinput is 1 + greenled = 1; //green led is off + redled = 0; // flash red led + wait(0.005); + redled = 1; + wait(0.005); + } //end of if + else { //here if switchinput is 1 + redled = 1; //red led is off + greenled = 0; // flash green led + wait(0.0025); + greenled = 1; + wait(0.0025); + } //end of else + } //end of while(1) +} //end of main
diff -r 000000000000 -r e556da5831a8 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jan 12 15:41:24 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3 \ No newline at end of file