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.
Revision 12:c1c8ac0136ed, committed 2021-02-25
- Comitter:
- SHLIU1@OANBE02333.nuvoton.com
- Date:
- Thu Feb 25 14:23:47 2021 +0800
- Parent:
- 11:7b0fff58d583
- Commit message:
- Support the both V5.X and V6.X for mbed-os
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Apr 18 16:35:31 2018 +0800 +++ b/main.cpp Thu Feb 25 14:23:47 2021 +0800 @@ -26,11 +26,18 @@ int note[15] = { // array of notes _C5, _D5, _E5, _F5, _G5, _A5, _B5, _C6, _D6, _E6, _F6, _G6, _A6, _B6}; +#ifdef MBED_MAJOR_VERSION + printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION); +#endif for (i=0; i<14; i++) { pwm0.period_us(1000000/note[i]); // set period per note pwm0.pulsewidth_us(1000000/note[i]/2); // set duty cycle to 50% +#if MBED_MAJOR_VERSION >= 6 + ThisThread::sleep_for(100); +#else Thread::wait(100); +#endif } pwm0.pulsewidth_us(0); // set dutycycle = 0% to stop }