This commit is contained in:
topicchi
2026-03-20 17:18:15 +00:00
parent 438d6354ae
commit 99748d82ac
105 changed files with 4770 additions and 3467 deletions

View File

@@ -4,12 +4,12 @@
### `attach()`
Attach the Servo variable to a pin. Note that in Arduino 0016 and earlier, the Servo library supports servos on only two pins: 9 and 10.
Attach the Servo variable to a pin. Note that in Arduino IDE 0016 and earlier, the Servo library supports servos on only two pins: 9 and 10.
#### Syntax
```
servo.attach(pin)
servo.attach(pin)
servo.attach(pin, min, max)
```
@@ -23,16 +23,16 @@ servo.attach(pin, min, max)
#### Example
```
#include <Servo.h>
#include <Servo.h>
Servo myservo;
void setup()
{
void setup()
{
myservo.attach(9);
}
}
void loop() {}
void loop() {}
```
#### See also
@@ -58,17 +58,17 @@ servo.write(angle)
#### Example
````
#include <Servo.h>
#include <Servo.h>
Servo myservo;
void setup()
{
void setup()
{
myservo.attach(9);
myservo.write(90); // set servo to mid-point
}
}
void loop() {}
void loop() {}
````
#### See also
@@ -81,7 +81,7 @@ Writes a value in microseconds (us) to the servo, controlling the shaft accordin
Note that some manufactures do not follow this standard very closely so that servos often respond to values between 700 and 2300. Feel free to increase these endpoints until the servo no longer continues to increase its range. Note however that attempting to drive a servo past its endpoints (often indicated by a growling sound) is a high-current state, and should be avoided.
Continuous-rotation servos will respond to the writeMicrosecond function in an analogous manner to the write function.
Continuous-rotation servos will respond to the writeMicrosecond function in an manner analogous to the write function.
#### Syntax
@@ -97,17 +97,17 @@ servo.writeMicroseconds(us)
#### Example
````
#include <Servo.h>
#include <Servo.h>
Servo myservo;
void setup()
{
void setup()
{
myservo.attach(9);
myservo.writeMicroseconds(1500); // set servo to mid-point
}
}
void loop() {}
void loop() {}
````
#### See also
@@ -118,7 +118,9 @@ void loop() {}
### `read()`
Read the current angle of the servo (the value passed to the last call to [write()](#write)).
Read the current setpoint of the servo (the angle passed to the last call to [write()](#write)).
Note that the servo has no way of reporting its current physical orientation. This method returns the angle to which the sketch program has requested the servo to move, regardless of whether the servo has already reached that angle.
#### Syntax
@@ -132,7 +134,7 @@ servo.read()
#### Returns
The angle of the servo, from 0 to 180 degrees.
The setpoint of the servo, as an angle from 0 to 180 degrees.
#### See also

View File

@@ -3,7 +3,7 @@
This library allows an Arduino board to control RC (hobby) servo motors. Servos have integrated gears and a shaft that can be precisely controlled. Standard servos allow the shaft to be positioned at various angles, usually between 0 and 180 degrees. Continuous rotation servos allow the rotation of the shaft to be set to various speeds.
The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables `analogWrite()` (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12.
The Servo library supports up to 12 motors on most Arduino boards and 48 on the Arduino Mega. On boards other than the Mega, use of the library disables `analogWrite()` (PWM) functionality on pins 9 and 10, whether or not there is a Servo on those pins. On the Mega, up to 12 servos can be used without interfering with PWM functionality; use of 12 to 23 motors will disable PWM on pins 11 and 12.
To use this library: