Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Bootcamp-HelloWorld_LED by
Revision 3:997ae35e2cee, committed 2014-04-20
- Comitter:
- shuyunzh
- Date:
- Sun Apr 20 05:13:35 2014 +0000
- Parent:
- 2:d243c01512ab
- Commit message:
- hw1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r d243c01512ab -r 997ae35e2cee main.cpp --- a/main.cpp Tue Apr 16 06:45:41 2013 +0000 +++ b/main.cpp Sun Apr 20 05:13:35 2014 +0000 @@ -1,25 +1,25 @@ #include "mbed.h" -DigitalOut red(LED1); -DigitalOut green(LED2); -DigitalOut blue(LED3); - -int main() { - while(1){ - red = 1; - green = blue = 0; - wait(0.2); +BusOut Bits(LED1,LED2,LED3,LED4); //LED outputs for counter + +char bin_val = 0x00; +bool updown; - // green - green = 1; - red = blue = 0; - wait(0.2); - - // blue - blue = 1; - red = green = 0; - wait(0.2); +int main() { + while(1) { + if(bin_val==0x0F) + updown=true; + if(bin_val==0x00) + updown=false; + if(!updown) // counting up + bin_val++; + if(updown) // counting down + bin_val--; + //Assign bin_val to led output + Bits = bin_val; + //wait 1 second + wait(1); } }