Servo/kr
« ServoA library for controlling a Radio Control (R/C) model Servo.
헬로 월드!¶
Library¶
Import library
Public Member Functions |
|
Servo (PinName pin) | |
Create a servo object connected to the specified PwmOut pin.
|
|
void | write (float percent) |
Set the servo position, normalised to it's full range.
|
|
float | read () |
Read the servo motors current position.
|
|
void | position (float degrees) |
Set the servo position.
|
|
void | calibrate (float range=0.0005, float degrees=45.0) |
Allows calibration of the range and angles for a particular servo.
|
|
Servo & | operator= (float percent) |
Shorthand for the write and read functions.
|
This library controls a standard R/C model servo using a PwmOut signal, and provides control of the servo between min and max by setting it to 0.0 - 1.0.
As all servos respond differently, you can also use the calibrate function the range, so 0.0 - 1.0 is the maximum range of the servo.