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 talking by
Revision 3:1b91d910dabd, committed 2017-02-11
- Comitter:
- faif
- Date:
- Sat Feb 11 15:49:06 2017 +0000
- Parent:
- 2:c6c74e788985
- Commit message:
- Reorganize code
Changed in this revision
cricket.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/cricket.cpp Sat Feb 11 15:45:54 2017 +0000 +++ b/cricket.cpp Sat Feb 11 15:49:06 2017 +0000 @@ -12,15 +12,6 @@ static const float ticker_rhythm = 10E-5; // 9.766 kHz sample rate (1/9766 sec delay) static const char clip_path[] = "/local/cricket.wav"; - -bool done = false; - - -void myrhythm() -{ - done = true; -} - int main () { const int size = 1165; // 32K max in total (~30K is enough for testing) @@ -38,6 +29,13 @@ } } +bool done = false; + +void myrhythm() +{ + done = true; +} + void waitForButton(DigitalOut& led, DigitalIn& button) { led = ON; @@ -68,12 +66,12 @@ void randomPause() { float c = rand() % 100; - // 30% percentage to wait 2 sec + // 30% chance to wait 2 sec if (c > 70) { wait(2); } - // 70% percentage to wait 0-1 sec + // 70% chance to wait 0-1 sec else { wait(c / 100);