Servo86.angleMap()

[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.

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

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール