[Servo86]
Description
The maximum pulse width and minimum pulse width of the servo will be mapped to the user-defined angle.
After calling attach(), the default minimum and maximum pulse widths will correspond to 0 and 180 degrees respectively, and you can call this function to change the corresponding angle.
Syntax
servo.angleMap(min, max)
Parameters
servo: Variable of Servo type.min: The minimum pulse width of servo to correspond to the angle, the value is expressed as a floating point number, the range is between 0.0 ~ 360.0, unit: degree.max: The maximum pulse width of the servo to correspond to the angle, the value is expressed as a floating point number, the range is between 0.0 ~ 360.0, unit: degree.
Returns
None.
Example
#include <Servo86.h>
Servo myservo;
void setup()
{
myservo.attach(9);
myservo.angleMap(0.0, 270.0); // 0 degrees is the minimum angle, 270 degrees is the maximum angle
myservo.write(90.0); // servo goes to 90 degrees
}
void loop() {}See also
Libraries Reference Home
The text of the 86Duino reference is a modification of the Arduino reference and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.