Edwin Foster
/
HelloWorld
First mbed program example and usage
Fork of HelloWorld by
Revision 4:48af6a1a72c6, committed 2014-11-08
- Comitter:
- efoster79
- Date:
- Sat Nov 08 14:10:49 2014 +0000
- Parent:
- 3:26b01dec4312
- Commit message:
- Condensed if/else statement to ternary statement
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 26b01dec4312 -r 48af6a1a72c6 main.cpp --- a/main.cpp Sat Oct 18 14:20:50 2014 +0000 +++ b/main.cpp Sat Nov 08 14:10:49 2014 +0000 @@ -12,14 +12,11 @@ while(1) { for(i = 0 ; i < TOTAL_LEDS; i++){ int value_to_check = i + 1; - if( value_to_check == last_selected){ - outleds[i] = 1; - }else{ - outleds[i] = 0; - } + outleds[i] = value_to_check == last_selected ? 1 : 0; } wait(1); + if(last_selected++ >= TOTAL_LEDS) last_selected = 1; }