Skip to content

Commit f36eb39

Browse files
authored
Merge pull request #119 from per1234/fix-typos
Fix typos in documentation
2 parents d1fb5d6 + d86695b commit f36eb39

17 files changed

+87
-87
lines changed

docs/api.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
### `attach()`
66

7-
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.
7+
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.
88

99
#### Syntax
1010

1111
```
12-
servo.attach(pin)
12+
servo.attach(pin)
1313
servo.attach(pin, min, max)
1414
```
1515

@@ -23,16 +23,16 @@ servo.attach(pin, min, max)
2323
#### Example
2424

2525
```
26-
#include <Servo.h>
26+
#include <Servo.h>
2727
2828
Servo myservo;
2929
30-
void setup()
31-
{
30+
void setup()
31+
{
3232
myservo.attach(9);
33-
}
33+
}
3434
35-
void loop() {}
35+
void loop() {}
3636
```
3737

3838
#### See also
@@ -58,17 +58,17 @@ servo.write(angle)
5858
#### Example
5959

6060
````
61-
#include <Servo.h>
61+
#include <Servo.h>
6262
6363
Servo myservo;
6464
65-
void setup()
66-
{
65+
void setup()
66+
{
6767
myservo.attach(9);
6868
myservo.write(90); // set servo to mid-point
69-
}
69+
}
7070
71-
void loop() {}
71+
void loop() {}
7272
````
7373
#### See also
7474

@@ -81,7 +81,7 @@ Writes a value in microseconds (us) to the servo, controlling the shaft accordin
8181

8282
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.
8383

84-
Continuous-rotation servos will respond to the writeMicrosecond function in an analogous manner to the write function.
84+
Continuous-rotation servos will respond to the writeMicrosecond function in an manner analogous to the write function.
8585

8686
#### Syntax
8787

@@ -97,17 +97,17 @@ servo.writeMicroseconds(us)
9797
#### Example
9898

9999
````
100-
#include <Servo.h>
100+
#include <Servo.h>
101101
102102
Servo myservo;
103103
104-
void setup()
105-
{
104+
void setup()
105+
{
106106
myservo.attach(9);
107107
myservo.writeMicroseconds(1500); // set servo to mid-point
108-
}
108+
}
109109
110-
void loop() {}
110+
void loop() {}
111111
````
112112

113113
#### See also

docs/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
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.
55

6-
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.
6+
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.
77

88
To use this library:
99

examples/Knob/Knob.ino

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
#include <Servo.h>
1111

12-
Servo myservo; // create servo object to control a servo
12+
Servo myservo; // create Servo object to control a servo
1313

1414
int potpin = A0; // analog pin used to connect the potentiometer
1515
int val; // variable to read the value from the analog pin
1616

1717
void setup() {
18-
myservo.attach(9); // attaches the servo on pin 9 to the servo object
18+
myservo.attach(9); // attaches the servo on pin 9 to the Servo object
1919
}
2020

2121
void loop() {

examples/Knob/readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Knob
22

3-
Control the position of a RC (hobby) [servo motor](http://en.wikipedia.org/wiki/Servo_motor#RC_servos) with your Arduino and a potentiometer.
3+
Control the position of an RC (hobby) [servo motor](http://en.wikipedia.org/wiki/Servo_motor#RC_servos) with your Arduino and a potentiometer.
44

55
This example makes use of the Arduino `Servo` library.
66

@@ -15,7 +15,7 @@ This example makes use of the Arduino `Servo` library.
1515

1616
Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino board. The ground wire is typically black or brown and should be connected to a ground pin on the board. The signal pin is typically yellow or orange and should be connected to pin 9 on the board.
1717

18-
The potentiometer should be wired so that its two outer pins are connected to power (+5V) and ground, and its middle pin is connected to analog input 0 on the board.
18+
The potentiometer should be wired so that its two outer pins are connected to power (5V) and ground, and its middle pin is connected to analog input 0 on the board.
1919

2020
![](images/knob_BB.png)
2121

examples/Sweep/Sweep.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99

1010
#include <Servo.h>
1111

12-
Servo myservo; // create servo object to control a servo
13-
// twelve servo objects can be created on most boards
12+
Servo myservo; // create Servo object to control a servo
13+
// twelve Servo objects can be created on most boards
1414

1515
int pos = 0; // variable to store the servo position
1616

1717
void setup() {
18-
myservo.attach(9); // attaches the servo on pin 9 to the servo object
18+
myservo.attach(9); // attaches the servo on pin 9 to the Servo object
1919
}
2020

2121
void loop() {

examples/Sweep/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Sweep
22

3-
Sweeps the shaft of a RC [servo motor](http://en.wikipedia.org/wiki/Servo_motor#RC_servos) back and forth across 180 degrees.
3+
Sweeps the shaft of an RC [servo motor](http://en.wikipedia.org/wiki/Servo_motor#RC_servos) back and forth across 180 degrees.
44

55
## Hardware Required
66

src/Servo.h

+29-29
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
3-
Copyright (c) 2009 Michael Margolis. All right reserved.
2+
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - Version 2
3+
Copyright (c) 2009 Michael Margolis. All right reserved.
44
55
This library is free software; you can redistribute it and/or
66
modify it under the terms of the GNU Lesser General Public
@@ -17,41 +17,41 @@
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
1919

20-
/*
21-
A servo is activated by creating an instance of the Servo class passing
20+
/*
21+
A servo is activated by creating an instance of the Servo class passing
2222
the desired pin to the attach() method.
23-
The servos are pulsed in the background using the value most recently
23+
The servos are pulsed in the background using the value most recently
2424
written using the write() method.
2525
26-
Note that analogWrite of PWM on pins associated with the timer are
26+
Note that analogWrite of PWM on pins associated with the timer are
2727
disabled when the first servo is attached.
28-
Timers are seized as needed in groups of 12 servos - 24 servos use two
28+
Timers are seized as needed in groups of 12 servos - 24 servos use two
2929
timers, 48 servos will use four.
3030
The sequence used to seize timers is defined in timers.h
3131
3232
The methods are:
3333
3434
Servo - Class for manipulating servo motors connected to Arduino pins.
3535
36-
attach(pin ) - Attaches a servo motor to an I/O pin.
36+
attach(pin ) - Attaches a servo motor to an I/O pin.
3737
attach(pin, min, max ) - Attaches to a pin setting min and max values in microseconds
38-
default min is 544, max is 2400
39-
40-
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
41-
writeMicroseconds() - Sets the servo pulse width in microseconds
42-
read() - Gets the last written servo pulse width as an angle between 0 and 180.
38+
default min is 544, max is 2400
39+
40+
write() - Sets the servo angle in degrees. (invalid angle that is valid as pulse in microseconds is treated as microseconds)
41+
writeMicroseconds() - Sets the servo pulse width in microseconds
42+
read() - Gets the last written servo pulse width as an angle between 0 and 180.
4343
readMicroseconds() - Gets the last written servo pulse width in microseconds. (was read_us() in first release)
44-
attached() - Returns true if there is a servo attached.
45-
detach() - Stops an attached servos from pulsing its I/O pin.
44+
attached() - Returns true if there is a servo attached.
45+
detach() - Stops an attached servos from pulsing its I/O pin.
4646
*/
4747

4848
#ifndef Servo_h
4949
#define Servo_h
5050

5151
#include <inttypes.h>
5252

53-
/*
54-
* Defines for 16 bit timers used with Servo library
53+
/*
54+
* Defines for 16 bit timers used with Servo library
5555
*
5656
* If _useTimerX is defined then TimerX is a 16 bit timer on the current board
5757
* timer16_Sequence_t enumerates the sequence that the timers should be allocated
@@ -81,12 +81,12 @@
8181

8282
#define Servo_VERSION 2 // software version of this library
8383

84-
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
85-
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
84+
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
85+
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
8686
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
87-
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
87+
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
8888

89-
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
89+
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
9090
#define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
9191

9292
#define INVALID_SERVO 255 // flag indicating an invalid servo index
@@ -95,8 +95,8 @@
9595

9696
typedef struct {
9797
uint8_t nbr :6 ; // a pin number from 0 to 63
98-
uint8_t isActive :1 ; // true if this channel is enabled, pin not pulsed if false
99-
} ServoPin_t ;
98+
uint8_t isActive :1 ; // true if this channel is enabled, pin not pulsed if false
99+
} ServoPin_t ;
100100

101101
typedef struct {
102102
ServoPin_t Pin;
@@ -108,17 +108,17 @@ class Servo
108108
public:
109109
Servo();
110110
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or INVALID_SERVO if failure
111-
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
111+
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
112112
void detach();
113-
void write(int value); // if value is < 200 its treated as an angle, otherwise as pulse width in microseconds
114-
void writeMicroseconds(int value); // Write pulse width in microseconds
113+
void write(int value); // if value is < 200 it's treated as an angle, otherwise as pulse width in microseconds
114+
void writeMicroseconds(int value); // Write pulse width in microseconds
115115
int read(); // returns current pulse width as an angle between 0 and 180 degrees
116116
int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
117-
bool attached(); // return true if this servo is attached, otherwise false
117+
bool attached(); // return true if this servo is attached, otherwise false
118118
private:
119119
uint8_t servoIndex; // index into the channel data for this servo
120-
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
121-
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
120+
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
121+
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
122122
};
123123

124124
#endif

src/avr/Servo.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
2+
Servo.cpp - Interrupt driven Servo library for Arduino using 16 bit timers - Version 2
33
Copyright (c) 2009 Michael Margolis. All right reserved.
44
55
This library is free software; you can redistribute it and/or
@@ -24,7 +24,7 @@
2424

2525
#include "Servo.h"
2626

27-
#define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to tick (assumes prescale of 8) // 12 Aug 2009
27+
#define usToTicks(_us) (( clockCyclesPerMicrosecond()* _us) / 8) // converts microseconds to ticks (assumes prescaler of 8) // 12 Aug 2009
2828
#define ticksToUs(_ticks) (( (unsigned)_ticks * 8)/ clockCyclesPerMicrosecond() ) // converts from ticks back to microseconds
2929

3030

@@ -62,7 +62,7 @@ static inline void handle_interrupts(timer16_Sequence_t timer, volatile uint16_t
6262
if( SERVO_INDEX(timer,Channel[timer]) < ServoCount && Channel[timer] < SERVOS_PER_TIMER) {
6363
*OCRnA = *TCNTn + SERVO(timer,Channel[timer]).ticks;
6464
if(SERVO(timer,Channel[timer]).Pin.isActive == true) // check if activated
65-
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // its an active channel so pulse it high
65+
digitalWrite( SERVO(timer,Channel[timer]).Pin.nbr,HIGH); // it's an active channel so pulse it high
6666
}
6767
else {
6868
// finished all channels so wait for the refresh period to expire before starting over

src/avr/ServoTimers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers- Version 2
2+
Servo.h - Interrupt driven Servo library for Arduino using 16 bit timers - Version 2
33
Copyright (c) 2009 Michael Margolis. All right reserved.
44
55
This library is free software; you can redistribute it and/or

src/megaavr/Servo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <Arduino.h>
44
#include <Servo.h>
55

6-
#define usToTicks(_us) ((clockCyclesPerMicrosecond() / 16 * _us) / 4) // converts microseconds to tick
6+
#define usToTicks(_us) ((clockCyclesPerMicrosecond() / 16 * _us) / 4) // converts microseconds to ticks
77
#define ticksToUs(_ticks) (((unsigned) _ticks * 16) / (clockCyclesPerMicrosecond() / 4)) // converts from ticks back to microseconds
88

99
#define TRIM_DURATION 5 // compensation ticks to trim adjust for digitalWrite delays

src/nrf52/Servo.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ Servo::Servo()
3535
{
3636
if (ServoCount < MAX_SERVOS) {
3737
this->servoIndex = ServoCount++; // assign a servo index to this instance
38-
} else {
38+
} else {
3939
this->servoIndex = INVALID_SERVO; // too many servos
4040
}
4141

4242
}
4343

4444
uint8_t Servo::attach(int pin)
4545
{
46-
46+
4747
return this->attach(pin, 0, 2500);
4848
}
4949

@@ -59,9 +59,9 @@ uint8_t Servo::attach(int pin, int min, int max)
5959
if (max > servo_max) max = servo_max;
6060
this->min = min;
6161
this->max = max;
62-
62+
6363
servos[this->servoIndex].Pin.isActive = true;
64-
64+
6565
}
6666
return this->servoIndex;
6767
}
@@ -73,13 +73,13 @@ void Servo::detach()
7373

7474

7575
void Servo::write(int value)
76-
{
76+
{
7777
if (value < 0)
7878
value = 0;
7979
else if (value > 180)
8080
value = 180;
8181
value = map(value, 0, 180, MIN_PULSE, MAX_PULSE);
82-
82+
8383
writeMicroseconds(value);
8484
}
8585

@@ -117,7 +117,7 @@ int Servo::read() // return the value as degrees
117117
}
118118

119119
int Servo::readMicroseconds()
120-
{
120+
{
121121
uint8_t channel, instance;
122122
uint8_t pin=servos[this->servoIndex].Pin.nbr;
123123
instance=(g_APinDescription[pin].ulPWMChannel & 0xF0)/16;

src/nrf52/ServoTimers.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818

1919
/*
20-
* nRF52 doesn't use timer, but PWM. This file include definitions to keep
20+
* nRF52 doesn't use timer, but PWM. This file includes definitions to keep
2121
* compatibility with the Servo library standards.
2222
*/
2323

src/renesas/Servo.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
#define SERVO_US_PER_CYCLE (20000)
3636
#define SERVO_IO_PORT_ADDR(pn) &((R_PORT0 + ((uint32_t) (R_PORT1 - R_PORT0) * (pn)))->PCNTR3)
3737

38-
// Internal Servo sturct to keep track of RA configuration.
38+
// Internal Servo struct to keep track of RA configuration.
3939
typedef struct {
4040
// Servo period in microseconds.
4141
uint32_t period_us;

0 commit comments

Comments
 (0)