Pager Motor Example

Revision:
4:aaa50ac098c9
Parent:
3:2e70eaa59446
Child:
5:e2c4377fac6d
--- a/main.cpp	Fri Dec 03 13:44:27 2021 +0000
+++ b/main.cpp	Fri Dec 03 14:09:19 2021 +0000
@@ -3,8 +3,9 @@
 #include "platform/mbed_thread.h"
 #include <string.h>
 
-// Blinking rate in milliseconds
-#define BLINKING_RATE_MS                                                    500
+// PWM Frequency
+#define PFREQ 500.0
+
 
 Serial pc(USBTX, USBRX); // tx, rx
 PwmOut p1(PA_8);
@@ -17,7 +18,7 @@
 
     // Initialise the digital pin LED1 as an output
     DigitalOut led(LED1);
-    
+    p1.period((float)1/PFREQ);
     p1.write(0.0);
     pc.printf("\n\rMotor> ");    
     while (true) {