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.
Dependencies: LSM9DS1 RangeFinder FastPWM
Dependents: PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board PM2_Example_PES_board ... more
Diff: Servo.h
- Revision:
- 4:9c003c402033
- Parent:
- 0:86129f1b4a93
- Child:
- 10:fe74e8909d3f
--- a/Servo.h Thu Apr 01 14:31:43 2021 +0000
+++ b/Servo.h Tue Apr 06 11:21:54 2021 +0000
@@ -32,25 +32,26 @@
* // Keep sweeping servo from left to right
* #include "mbed.h"
* #include "Servo.h"
- *
+ *
* Servo Servo1(p20);
*
* Servo1.Enable(1500,20000);
*
* while(1) {
* for (int pos = 1000; pos < 2000; pos += 25) {
- * Servo1.SetPosition(pos);
+ * Servo1.SetPosition(pos);
* wait_ms(20);
* }
* for (int pos = 2000; pos > 1000; pos -= 25) {
- * Servo1.SetPosition(pos);
- * wait_ms(20);
+ * Servo1.SetPosition(pos);
+ * wait_ms(20);
* }
* }
* @endcode
*/
-class Servo {
+class Servo
+{
public:
/** Create a new Servo object on any mbed pin
@@ -58,20 +59,20 @@
* @param Pin Pin on mbed to connect servo to
*/
Servo(PinName Pin);
-
+
/** Change the position of the servo. Position in us
*
* @param NewPos The new value of the servos position (us)
*/
void SetPosition(int NewPos);
-
+
/** Enable the servo. Without enabling the servo won't be running. Startposition and period both in us.
*
- * @param StartPos The position of the servo to start (us)
+ * @param StartPos The position of the servo to start (us)
* @param Period The time between every pulse. 20000 us = 50 Hz(standard) (us)
*/
void Enable(int StartPos, int Period);
-
+
/** Disable the servo. After disabling the servo won't get any signal anymore
*
*/
