My fully self designed first stable working Quadrocopter Software.
Servo Class Reference
Class to control a servo on any pin, without using pwm. More...
#include <Servo.h>
Public Member Functions | |
Servo (PinName Pin, int frequency) | |
Create a new Servo object on any mbed pin. | |
void | SetPosition (int NewPos) |
Change the position of the servo. | |
void | Enable (int StartPos, int Period) |
Enable the servo. |
Detailed Description
Class to control a servo on any pin, without using pwm.
Example:
// 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); wait_ms(20); } for (int pos = 2000; pos > 1000; pos -= 25) { Servo1.SetPosition(pos); wait_ms(20); } }
Definition at line 33 of file Servo.h.
Constructor & Destructor Documentation
Servo | ( | PinName | Pin, |
int | frequency | ||
) |
Member Function Documentation
void Enable | ( | int | StartPos, |
int | Period | ||
) |
Generated on Thu Jul 14 2022 18:09:09 by 1.7.2