You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-49Lines changed: 7 additions & 49 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Development began with a fork of the Arduino PID Library. Modifications and new
16
16
-`POn` parameter controls the setpoint weighting and mix of Proportional on Error to Proportional on Measurement
17
17
- Reorganized and more efficient PID algorithm, faster analog read function, micros() timing resolution
18
18
- Runs a complete PID cycle (*read-compute-write*) faster than just an `analogRead()` command in Arduino
19
-
- Includes a complete`analogWrite()`function for ESP32 boards. This controls up to 9 independent PWM pins and 2 DAC pins.
19
+
- Includes a complete[analogWritefunction for ESP32](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite) boards. This controls up to 8 independent PWM pins and 2 DAC pins.
20
20
21
21
### Performance
22
22
@@ -172,60 +172,18 @@ int QuickPID::analogReadFast(int ADCpin)
172
172
173
173
A faster configuration of `analogRead()`where a preset of 32 is used. If the architecture definition isn't found, normal `analogRead()`is used to return a value.
174
174
175
-
#### AnalogWrite (PWM and DAC) for ESP32
175
+
#### [AnalogWrite (PWM and DAC) for ESP32](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite)
176
176
177
-
```c++
178
-
void analogWrite(uint8_t pin, uint32_t value)
179
-
```
180
-
181
-
Call this function just like in the standard Arduino framework. It controls up to 9 independent PWM outputs and 2 DAC outputs. The controllable GPIO pins are 2, 4, 13, 14, 16, 17, 27, 32 and 33 for PWM and DAC0 (GPIO25) and DAC1 (GPIO26) for true analog outputs. The default PWM frequency is 5000 Hz and the default resolution is 13-bit (0-8191).
182
-
183
-
#### AnalogWrite Configuration Functions for ESP32
184
-
185
-
```c++
186
-
voidanalogWriteFrequency(float frequency = 5000);
187
-
void analogWriteFrequency(uint8_t pin, float frequency = 5000);
Calling `analogWriteFrequency(frequency)`will set the PWM frequency for all 8 assigned pins. Using `analogWriteFrequency(0)`will detach the 9 assigned pins and set them as input.
193
-
194
-
To independently assign a unique frequency to each PWM pin, use the `analogWriteFrequency(pin, frequency)` function. If the frequency is set to 0, this function will detach the referenced pin and configure it as an input.
195
-
196
-
Calling `analogWriteResolution(resolution)` will set the resolution for all 9 assigned pins. Read more about the [Supported Range of Frequency and Duty Resolution](https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/peripherals/ledc.html#ledc-api-supported-range-frequency-duty-resolution) here.
177
+
#### Change Log
197
178
198
-
To independently assign a unique frequency to each PWM pin, use the `analogWriteResolution(pin, resolution)` function. Note that it is required to call this function once prior to using AnalogWrite as this will automatically setup and attach (initialize) the pin.
0 commit comments