[Servo86]
描述
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.
語法
servo.angleMap(min, max)
參數
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.
回傳
無
範例
#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() {}
參考
函式庫參考主頁面
86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。