Skip to content

Commit 36ff10d

Browse files
Update analogWrite.adoc
Added a table summarizing the Boards, PWM Pins and the frequencies. Address the issue arduino#587
1 parent 8370cea commit 36ff10d

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

Language/Functions/Analog IO/analogWrite.adoc

+16-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,23 @@ subCategories: [ "Analog I/O" ]
1717

1818
[float]
1919
=== Description
20-
Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady square wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin. The frequency of the PWM signal on most pins is approximately 490 Hz. On the Uno and similar boards, pins 5 and 6 have a frequency of approximately 980 Hz.
20+
Writes an analog value (http://arduino.cc/en/Tutorial/PWM[PWM wave]) to a pin. Can be used to light a LED at varying brightnesses or drive a motor at various speeds. After a call to `analogWrite()`, the pin will generate a steady square wave of the specified duty cycle until the next call to `analogWrite()` (or a call to `digitalRead()` or `digitalWrite()`) on the same pin.
21+
[options="header"]
22+
|================================================================================================================================================
23+
| Board | PWM Pins | PWM Frequency
24+
| Uno, Nano, Mini | 3, 5, 6, 9, 10 and 11 | 490 Hz, exception pin 5 and 6(980 Hz)
25+
| Mega | 2 - 13 and 44 - 46 | 490 Hz, exception pin 4 and 13(980 Hz)
26+
| Leonardo, Micro, Yún | 3, 5, 6, 9, 10 and 11 | 490 Hz, exception pin 3 and 11(980 Hz)
27+
| Uno WiFi Rev.2 | 3, 5, 6, 9 and 10 | 490 Hz
28+
| MKR boards | 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, A3 - or 18 -, A4 -or 19 | 732 Hz
29+
| Zero | 3, 4, 5, 6, 8, 9, 10, 11, 12, 13 | 730 Hz
30+
| Due | 3, 5, 6, 9, 10 and 11 | 1000 Hz
31+
| 101 | 3, 5, 6 and 9 | 490 Hz
32+
|================================================================================================================================================
33+
34+
2135
[%hardbreaks]
22-
On most Arduino boards (those with the ATmega168 or ATmega328P), this function works on pins 3, 5, 6, 9, 10, and 11. On the Arduino Mega, it works on pins 2 - 13 and 44 - 46. Older Arduino boards with an ATmega8 only support `analogWrite()` on pins 9, 10, and 11.
23-
The Arduino DUE supports `analogWrite()` on pins 2 through 13, plus pins DAC0 and DAC1. Unlike the PWM pins, DAC0 and DAC1 are Digital to Analog converters, and act as true analog outputs.
36+
2437
You do not need to call `pinMode()` to set the pin as an output before calling `analogWrite()`.
2538
The `analogWrite` function has nothing to do with the analog pins or the `analogRead` function.
2639
[%hardbreaks]

0 commit comments

Comments
 (0)