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.
Diff: main.cpp
- Revision:
- 2:d7665651b223
- Parent:
- 0:cc0c210616de
--- a/main.cpp Thu Oct 01 16:50:29 2020 +0000 +++ b/main.cpp Thu Oct 01 17:05:04 2020 +0000 @@ -5,6 +5,21 @@ DigitalIn switch_input(p17); Serial pc(USBTX, USBRX); +int second() { +int count = 0; +while(count< 10) { + if(switch_input== 1){ + int check = switch_input; + pc.printf("DBG [%d] count: %d\r\n", switch_input.read(), count); + + while(check){ + if(check - switch_input== 1){ + count++; + check= 0; + pc.printf("DBG [%d] count: %d\r\n", switch_input.read(), count); + }}}} + return count;} + int main() { while(1) { if (switch_input==1) { @@ -22,20 +37,7 @@ wait(0.3); } }} -int second() { -int count = 0; -while(count< 10) { - if(switch_input== 1){ - int check = switch_input; - pc.printf("DBG [%d] count: %d\r\n", switch_input.read(), count); - - while(check){ - if(check - switch_input== 1){ - count++; - check= 0; - pc.printf("DBG [%d] count: %d\r\n", switch_input.read(), count); - }}}} - return count;} +