From aefc63b0618e0726927738e2f1e7ce8cbc34f1a9 Mon Sep 17 00:00:00 2001 From: Develo Date: Sun, 5 May 2019 01:18:27 -0400 Subject: [PATCH 1/2] Update reference.rst Clarify analogWrite and PWM limitations. --- doc/reference.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/reference.rst b/doc/reference.rst index 62c1d04aef..9a0403d136 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -70,7 +70,9 @@ equal to 1023 by default. PWM range may be changed by calling ``analogWriteRange(new_range)``. PWM frequency is 1kHz by default. Call -``analogWriteFreq(new_frequency)`` to change the frequency. +``analogWriteFreq(new_frequency)`` to change the frequency. Valid values are from 100Hz up to 40000Hz. + +The ESP doesn't have hardware PWM, so the implementation is by software. With one PWM output at 40KHz, the cpu is already rather loaded. The more PWM outputs used, and the higher their frequency, the closer you get to the CPU limits. Timing and delays ----------------- From 7bb7edf12a83c696ffe57ccd8ef7e01e97b5b7e0 Mon Sep 17 00:00:00 2001 From: Develo Date: Sun, 5 May 2019 01:23:12 -0400 Subject: [PATCH 2/2] Update reference.rst --- doc/reference.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/reference.rst b/doc/reference.rst index 9a0403d136..da033ff545 100644 --- a/doc/reference.rst +++ b/doc/reference.rst @@ -70,9 +70,13 @@ equal to 1023 by default. PWM range may be changed by calling ``analogWriteRange(new_range)``. PWM frequency is 1kHz by default. Call -``analogWriteFreq(new_frequency)`` to change the frequency. Valid values are from 100Hz up to 40000Hz. +``analogWriteFreq(new_frequency)`` to change the frequency. Valid values +are from 100Hz up to 40000Hz. -The ESP doesn't have hardware PWM, so the implementation is by software. With one PWM output at 40KHz, the cpu is already rather loaded. The more PWM outputs used, and the higher their frequency, the closer you get to the CPU limits. +The ESP doesn't have hardware PWM, so the implementation is by software. +With one PWM output at 40KHz, the CPU is already rather loaded. The more +PWM outputs used, and the higher their frequency, the closer you get to +the CPU limits, and the less CPU cycles are available for sketch execution. Timing and delays -----------------