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.
Diff: Servo.cpp
- 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