Skip to content

Commit 6f710d6

Browse files
committed
Correct typos in comments and documentation
1 parent 4d47a3f commit 6f710d6

File tree

20 files changed

+63
-69
lines changed

20 files changed

+63
-69
lines changed

docs/api.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### `attach()`
66

7-
Attach the Servo variable to a pin. Note that in Arduino 0016 and earlier, the Servo library supports only servos on only two pins: 9 and 10.
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.
88

99
#### Syntax
1010

@@ -17,8 +17,8 @@ servo.attach(pin, min, max)
1717

1818
* _servo_: a variable of type `Servo`
1919
* _pin_: the number of the pin that the servo is attached to
20-
* _min_ (optional): the pulse width, in microseconds, corresponding to the minimum (0-degree) angle on the servo (defaults to 544)
21-
* _max_ (optional): the pulse width, in microseconds, corresponding to the maximum (180-degree) angle on the servo (defaults to 2400)
20+
* _min_ (optional): the pulse width, in microseconds, corresponding to the minimum (0 degree) angle on the servo (defaults to 544)
21+
* _max_ (optional): the pulse width, in microseconds, corresponding to the maximum (180 degree) angle on the servo (defaults to 2400)
2222

2323
#### Example
2424

@@ -77,7 +77,7 @@ void loop() {}
7777

7878
### `writeMicroseconds()`
7979

80-
Writes a value in microseconds (uS) to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft. On standard servos a parameter value of 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.
80+
Writes a value in microseconds (us) to the servo, controlling the shaft accordingly. On a standard servo, this will set the angle of the shaft. On standard servos a parameter value of 1000 is fully counter-clockwise, 2000 is fully clockwise, and 1500 is in the middle.
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

@@ -86,13 +86,13 @@ Continuous-rotation servos will respond to the writeMicrosecond function in an a
8686
#### Syntax
8787

8888
````
89-
servo.writeMicroseconds(uS)
89+
servo.writeMicroseconds(us)
9090
````
9191

9292
#### Parameters
9393

9494
* _servo_: a variable of type Servo
95-
* _uS_: the value of the parameter in microseconds (int)
95+
* _us_: the value of the parameter in microseconds (int)
9696

9797
#### Example
9898

@@ -163,7 +163,7 @@ servo.attached()
163163

164164
### `detach()`
165165

166-
Detach the Servo variable from its pin. If all Servo variables are detached, then pins 9 and 10 can be used for PWM output with [analogWrite()](#analogwrite).
166+
Detach the Servo variable from its pin. If all Servo variables are detached, then pins 9 and 10 can be used for PWM output with [analogWrite()](https://www.arduino.cc/reference/en/language/functions/analog-io/analogwrite/).
167167

168168
#### Syntax
169169

docs/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ To use this library:
1313

1414
## Circuit
1515

16-
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 Arduino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board. Note that servos draw considerable power, so if you need to drive more than one or two, you'll probably need to power them from a separate supply (i.e. not the +5V pin on your Arduino). Be sure to connect the grounds of the Arduino and external power supply together.
16+
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 Arduino board. The signal pin is typically yellow, orange or white and should be connected to a digital pin on the Arduino board. Note that servos draw considerable power, so if you need to drive more than one or two, you'll probably need to power them from a separate supply (i.e. not the 5V pin on your Arduino). Be sure to connect the grounds of the Arduino and external power supply together.
1717

1818
## Examples
1919

2020
* [Knob](https://www.arduino.cc/en/Tutorial/Knob): control the shaft of a servo motor by turning a potentiometer
21-
* [Sweep](https://www.arduino.cc/en/Tutorial/Sweep): sweeps the shaft of a servo motor back and forth
21+
* [Sweep](https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep): sweeps the shaft of a servo motor back and forth

examples/Knob/Knob.ino

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ void setup() {
2020

2121
void loop() {
2222
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
23-
val = map(val, 0, 1023, 0, 180); // scale it to use it with the servo (value between 0 and 180)
23+
val = map(val, 0, 1023, 0, 180); // scale it for use with the servo (value between 0 and 180)
2424
myservo.write(val); // sets the servo position according to the scaled value
2525
delay(15); // waits for the servo to get there
2626
}
27-

examples/Knob/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This example makes use of the Arduino `Servo` library.
1313

1414
## Circuit
1515

16-
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 or Genuino 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.
16+
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

1818
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

examples/Sweep/Sweep.ino

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
modified 8 Nov 2013
66
by Scott Fitzgerald
7-
http://www.arduino.cc/en/Tutorial/Sweep
7+
https://www.arduino.cc/en/Tutorial/LibraryExamples/Sweep
88
*/
99

1010
#include <Servo.h>
@@ -22,11 +22,10 @@ void loop() {
2222
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
2323
// in steps of 1 degree
2424
myservo.write(pos); // tell servo to go to position in variable 'pos'
25-
delay(15); // waits 15ms for the servo to reach the position
25+
delay(15); // waits 15 ms for the servo to reach the position
2626
}
2727
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
2828
myservo.write(pos); // tell servo to go to position in variable 'pos'
29-
delay(15); // waits 15ms for the servo to reach the position
29+
delay(15); // waits 15 ms for the servo to reach the position
3030
}
3131
}
32-

examples/Sweep/readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Sweeps the shaft of a RC [servo motor](http://en.wikipedia.org/wiki/Servo_motor#
1010

1111
## Circuit
1212

13-
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 or Genuino 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, orange or white and should be connected to pin 9 on the board.
13+
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, orange or white and should be connected to pin 9 on the board.
1414

1515
![](images/sweep_bb.png)
1616

@@ -26,4 +26,4 @@ Servo motors have three wires: power, ground, and signal. The power wire is typi
2626
* [write()](/docs/api.md#write)
2727
* [map()](https://www.arduino.cc/en/Reference/Map)
2828
* [Servo library reference](/docs/readme.md)
29-
* [Knob](../Knob) - Sweep the shaft of a servo motor back and forth
29+
* [Knob](../Knob) - Control the position of a servo with a potentiometer

library.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ name=Servo
22
version=1.1.7
33
author=Michael Margolis, Arduino
44
maintainer=Arduino <[email protected]>
5-
sentence=Allows Arduino/Genuino boards to control a variety of servo motors.
6-
paragraph=This library can control a great number of servos.<br />It makes careful use of timers: the library can control 12 servos using only 1 timer.<br />On the Arduino Due you can control up to 60 servos.<br />
5+
sentence=Allows Arduino boards to control a variety of servo motors.
6+
paragraph=This library can control a great number of servos.<br />It makes careful use of timers: the library can control 12 servos using only 1 timer.<br />On the Arduino Due you can control up to 60 servos.
77
category=Device Control
8-
url=http://www.arduino.cc/en/Reference/Servo
8+
url=https://www.arduino.cc/reference/en/libraries/servo/
99
architectures=avr,megaavr,sam,samd,nrf52,stm32f4,mbed

src/Servo.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@
2727
disabled when the first servo is attached.
2828
Timers are seized as needed in groups of 12 servos - 24 servos use two
2929
timers, 48 servos will use four.
30-
The sequence used to sieze timers is defined in timers.h
30+
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
3838
default min is 544, max is 2400
3939
@@ -42,7 +42,7 @@
4242
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)
4444
attached() - Returns true if there is a servo attached.
45-
detach() - Stops an attached servos from pulsing its i/o pin.
45+
detach() - Stops an attached servos from pulsing its I/O pin.
4646
*/
4747

4848
#ifndef Servo_h
@@ -51,7 +51,7 @@
5151
#include <inttypes.h>
5252

5353
/*
54-
* Defines for 16 bit timers used with Servo library
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
@@ -82,7 +82,7 @@
8282
#define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
8383
#define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
8484
#define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
85-
#define REFRESH_INTERVAL 20000 // minumim time to refresh servos in microseconds
85+
#define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
8686

8787
#define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
8888
#define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)

src/avr/Servo.cpp

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ uint8_t ServoCount = 0; // the total number
4444
#define SERVO_INDEX(_timer,_channel) ((_timer*SERVOS_PER_TIMER) + _channel) // macro to access servo index by timer and channel
4545
#define SERVO(_timer,_channel) (servos[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel
4646

47-
#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4) // minimum value in uS for this servo
48-
#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4) // maximum value in uS for this servo
47+
#define SERVO_MIN() (MIN_PULSE_WIDTH - this->min * 4) // minimum value in us for this servo
48+
#define SERVO_MAX() (MAX_PULSE_WIDTH - this->max * 4) // maximum value in us for this servo
4949

5050
/************ static functions common to all instances ***********************/
5151

@@ -129,11 +129,11 @@ static void initISR(timer16_Sequence_t timer)
129129
TCCR1B = _BV(CS11); // set prescaler of 8
130130
TCNT1 = 0; // clear the timer count
131131
#if defined(__AVR_ATmega8__)|| defined(__AVR_ATmega128__)
132-
TIFR |= _BV(OCF1A); // clear any pending interrupts;
132+
TIFR |= _BV(OCF1A); // clear any pending interrupts
133133
TIMSK |= _BV(OCIE1A) ; // enable the output compare interrupt
134134
#else
135135
// here if not ATmega8 or ATmega128
136-
TIFR1 |= _BV(OCF1A); // clear any pending interrupts;
136+
TIFR1 |= _BV(OCF1A); // clear any pending interrupts
137137
TIMSK1 |= _BV(OCIE1A) ; // enable the output compare interrupt
138138
#endif
139139
#if defined(WIRING)
@@ -148,10 +148,10 @@ static void initISR(timer16_Sequence_t timer)
148148
TCCR3B = _BV(CS31); // set prescaler of 8
149149
TCNT3 = 0; // clear the timer count
150150
#if defined(__AVR_ATmega128__)
151-
TIFR |= _BV(OCF3A); // clear any pending interrupts;
151+
TIFR |= _BV(OCF3A); // clear any pending interrupts
152152
ETIMSK |= _BV(OCIE3A); // enable the output compare interrupt
153153
#else
154-
TIFR3 = _BV(OCF3A); // clear any pending interrupts;
154+
TIFR3 = _BV(OCF3A); // clear any pending interrupts
155155
TIMSK3 = _BV(OCIE3A) ; // enable the output compare interrupt
156156
#endif
157157
#if defined(WIRING)
@@ -165,7 +165,7 @@ static void initISR(timer16_Sequence_t timer)
165165
TCCR4A = 0; // normal counting mode
166166
TCCR4B = _BV(CS41); // set prescaler of 8
167167
TCNT4 = 0; // clear the timer count
168-
TIFR4 = _BV(OCF4A); // clear any pending interrupts;
168+
TIFR4 = _BV(OCF4A); // clear any pending interrupts
169169
TIMSK4 = _BV(OCIE4A) ; // enable the output compare interrupt
170170
}
171171
#endif
@@ -175,7 +175,7 @@ static void initISR(timer16_Sequence_t timer)
175175
TCCR5A = 0; // normal counting mode
176176
TCCR5B = _BV(CS51); // set prescaler of 8
177177
TCNT5 = 0; // clear the timer count
178-
TIFR5 = _BV(OCF5A); // clear any pending interrupts;
178+
TIFR5 = _BV(OCF5A); // clear any pending interrupts
179179
TIMSK5 = _BV(OCIE5A) ; // enable the output compare interrupt
180180
}
181181
#endif
@@ -202,7 +202,7 @@ static void finISR(timer16_Sequence_t timer)
202202
timerDetach(TIMER3OUTCOMPAREA_INT);
203203
}
204204
#else
205-
//For arduino - in future: call here to a currently undefined function to reset the timer
205+
//For Arduino - in future: call here to a currently undefined function to reset the timer
206206
(void) timer; // squash "unused parameter 'timer' [-Wunused-parameter]" warning
207207
#endif
208208
}
@@ -241,7 +241,7 @@ uint8_t Servo::attach(int pin, int min, int max)
241241
pinMode( pin, OUTPUT) ; // set servo pin to output
242242
servos[this->servoIndex].Pin.nbr = pin;
243243
// todo min/max check: abs(min - MIN_PULSE_WIDTH) /4 < 128
244-
this->min = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 uS
244+
this->min = (MIN_PULSE_WIDTH - min)/4; //resolution of min/max is 4 us
245245
this->max = (MAX_PULSE_WIDTH - max)/4;
246246
// initialize the timer if it has not already been initialized
247247
timer16_Sequence_t timer = SERVO_INDEX_TO_TIMER(servoIndex);
@@ -315,4 +315,3 @@ bool Servo::attached()
315315
}
316316

317317
#endif // ARDUINO_ARCH_AVR
318-

src/avr/ServoTimers.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919

2020
/*
21-
* Defines for 16 bit timers used with Servo library
21+
* Defines for 16 bit timers used with Servo library
2222
*
2323
* If _useTimerX is defined then TimerX is a 16 bit timer on the current board
2424
* timer16_Sequence_t enumerates the sequence that the timers should be allocated
@@ -56,4 +56,3 @@ typedef enum { _timer3, _timer1, _Nbr_16timers } timer16_Sequence_t;
5656
#define _useTimer1
5757
typedef enum { _timer1, _Nbr_16timers } timer16_Sequence_t;
5858
#endif
59-

0 commit comments

Comments
 (0)