NuMaker PWM1 drive +5V DC servo motor

Revision:
12:c7ca6b6c7fbc
Parent:
9:64a0098bb8df
--- a/main.cpp	Wed Apr 18 16:57:19 2018 +0800
+++ b/main.cpp	Thu Feb 25 11:24:43 2021 +0800
@@ -8,11 +8,18 @@
     
     int i=0;
     printf("...DCserv Start...\n\r");
+#ifdef MBED_MAJOR_VERSION
+    printf("Mbed OS version %d.%d.%d\r\n\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
+#endif
     pwm1.period_us(20000);      // set PWM period to 20ms (50Hz)
         
     for (i=500; i<=2500; i=i+200) { // from 0.5ms to 2.5ms
         pwm1.pulsewidth_us(i);      // set PWM pulse width to rotate motor
+#if MBED_MAJOR_VERSION >= 6
+        ThisThread::sleep_for(1000);
+#else
         Thread::wait(1000);         // delay
+#endif
         printf("DCservo pulse width = %d\n\r", i);
     } 
     printf("...DCserv End.....\n\r");