#include <Servo.h>
Servo control class, based on a PwmOut
Example:
#include "mbed.h"
while(1) {
for(
int i=0;
i<100;
i++) {
wait(0.01);
}
for(
int i=100;
i>0;
i--) {
wait(0.01);
}
}
}
Definition at line 52 of file Servo.h.
| Servo::Servo |
( |
PinName |
pin | ) |
|
Create a servo object connected to the specified PwmOut pin
- Parameters
-
| pin | PwmOut pin to connect to |
| void Servo::calibrate |
( |
float |
range = 0.0005, |
|
|
float |
degrees = 45.0 |
|
) |
| |
Allows calibration of the range and angles for a particular servo
- Parameters
-
| range | Pulsewidth range from center (1.5ms) to maximum/minimum position in seconds |
| degrees | Angle from centre to maximum/minimum position in degrees |
| Servo::operator float |
( |
| ) |
|
| Servo& Servo::operator= |
( |
float |
percent | ) |
|
Shorthand for the write and read functions
| void Servo::position |
( |
float |
degrees | ) |
|
Set the servo position
- Parameters
-
| degrees | Servo position in degrees |
Read the servo motors current position
- Parameters
-
| returns | A normalised number 0.0-1.0 representing the full range. |
| void Servo::write |
( |
float |
percent | ) |
|
Set the servo position, normalised to it's full range
- Parameters
-
| percent | A normalised number 0.0-1.0 to represent the full range. |
The documentation for this class was generated from the following file: