ng ho lung / Mbed OS XP70HV
Revision:
0:e35f0aee6a1f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Servo.cpp	Tue Jun 23 02:47:53 2020 +0000
@@ -0,0 +1,20 @@
+#include "mbed.h"
+#include "Servo.h"
+
+Servo::Servo(PinName pin, double period, double pulseWidth)
+{
+  servo = new PwmOut(pin);
+  this->period = period;
+  this->pulseWidth = pulseWidth;
+  init();
+}
+
+void Servo::servoMove(double width)
+{
+  servo->pulsewidth(width);
+}
+
+void Servo::init()
+{
+  servo->period(period);
+}
\ No newline at end of file