#include <Servo.h>
Servo control class, based on a PwmOut
Example:
#include "mbed.h"
while(1) {
for(
int i=0;
i<100;
i++) {
}
for(
int i=100;
i>0;
i--) {
}
}
}
Definition at line 52 of file Servo.h.
◆ Servo()
Servo::Servo |
( |
PinName |
pin | ) |
|
Create a servo object connected to the specified PwmOut pin
- Parameters
-
pin | PwmOut pin to connect to |
◆ calibrate()
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 |
◆ operator float()
Servo::operator float |
( |
| ) |
|
◆ operator=() [1/2]
Servo& Servo::operator= |
( |
float |
percent | ) |
|
Shorthand for the write and read functions
◆ operator=() [2/2]
◆ position()
void Servo::position |
( |
float |
degrees | ) |
|
Set the servo position
- Parameters
-
degrees | Servo position in degrees |
◆ read()
Read the servo motors current position
- Parameters
-
returns | A normalised number 0.0-1.0 representing the full range. |
◆ write()
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. |
◆ _degrees
◆ _p
◆ _pwm
◆ _range
The documentation for this class was generated from the following file: