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:015640054db1, committed 2021-02-24
- Comitter:
- SHLIU1@OANBE02333.nuvoton.com
- Date:
- Wed Feb 24 16:27:23 2021 +0800
- Parent:
- 11:58b88abed368
- Commit message:
- Support the both V5.X and V6.X
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Apr 19 09:31:55 2018 +0800
+++ b/main.cpp Wed Feb 24 16:27:23 2021 +0800
@@ -8,11 +8,19 @@
int main(void)
{
+#ifdef MBED_MAJOR_VERSION
+ printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
+#endif
printf("ADC0 start reading...\n\r");
while (1) {
printf("ADC0 value= 0x%4x, percentage= %3.3f%%\n\r",adc0.read_u16(), adc0.read()*100.0f);
if(adc0 > 0.7f) led = 0; // > 0.7 * Vcc wil turn on led
else led = 1;
+#if MBED_MAJOR_VERSION >= 6
+ ThisThread::sleep_for(200);
+#else
wait(0.2f);
+#endif
+
}
}