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
-[](https://wokwi.com/projects/360276061783595009)[Servo Easing](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite/blob/main/examples/Servo-Easing/Servo-Easing.ino) Controls three servos with different easing settings
31
+
-[](https://wokwi.com/projects/360276061783595009)[Servo_Easing_Time](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite/blob/main/examples/Servo_Easing_Time/Servo_Easing_Time.ino) 3 servos with different easing constants and timed position control
32
+
33
+
-[](https://wokwi.com/projects/361237697368753153)[Servo_Easing_Position](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite/blob/main/examples/Servo_Easing_Position/Servo_Easing_Position.ino) 3 servos with different easing constants and position feedback control
32
34
33
35
-[](https://wokwi.com/projects/355852275661848577)[ESP32_C3_6_Servo_Knob](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite/blob/main/examples/ESP32_C3_6_Servo_Knob/ESP32_C3_6_Servo_Knob.ino) Potentiometer control of 6 servos on an ESP32-C3
-[](https://wokwi.com/projects/349322326995632722)[2 Sync 300kHz](https://github.com/Dlloydev/ESP32-ESP32S2-AnalogWrite/blob/main/examples/ESP32_Sync2_300kHz/ESP32_Sync2_300kHz.ino) 2 synchronized PWM outputs using the same timer (channel pair)
@@ -153,7 +153,7 @@ The frequency and resolution values are shared by each channel pair. When any ch
153
153
154
154
**Attaching to free Channel**
155
155
156
-
This process is automatic - the servo pin will be attached to the next free channel. If you need to assign the servo pin(s) to specific channels or to set the minimum, default or maximum microsecond values, then call the `attach()`method first.
156
+
This process is automatic - the servo pin will be attached to the next free channel. If you need to assign the servo pin(s) to specific channels or to set the minimum or maximum microsecond values, then call the `attach()`method first.
157
157
158
158
##### Syntax
159
159
@@ -292,28 +292,27 @@ readMicroseconds(pin)
292
292
293
293
##### Description
294
294
295
-
This function allows auto-attaching a pin to the first available channel if only the pin is specified. To have the pin assigned to a specific channel, use both the pin and channel (ch) parameters. Additionally, there are parameters available for setting the servo timer values for minimum, default and maximum microseconds.
295
+
This function allows auto-attaching a pin to the first available channel if only the pin is specified. To have the pin assigned to a specific channel, use both the pin and channel (ch) parameters. Additionally, there are parameters available for setting the servo timer values for minimum and maximum microseconds.
296
296
297
297
**Syntax**
298
298
299
299
```c++
300
-
attach(pin) // auto attach to 1st free channel
301
-
attach(pin, ch, invert) // attach to ch, optional invert
attach(pin, ch, minUs, defUs, maxUs) // attach to ch with servo limits
304
-
attach(pin, ch, minUs, defUs, maxUs, speed, ke) // as above with speed, easing constant
305
-
attach(pin, ch, minUs, defUs, maxUs, speed, ke, invert) // as above with invert
300
+
attach(pin) // auto attach to 1st free channel
301
+
attach(pin, ch) // attach to specified channel
302
+
attach(pin, minUs, maxUs) // auto attach to free ch with servo limits
303
+
attach(pin, ch, minUs, maxUs) // attach to specified ch with servo limits
304
+
attach(pin, minUs, maxUs, speed, ke) // attach to free ch with speed and easing constant
305
+
attach(pin, ch, minUs, maxUs, speed, ke) // as above but attaches to specified channel
306
+
attach(pin, ch, minUs, maxUs, speed, ke, invert) // as above with invert
306
307
```
307
308
308
309
##### Parameters
309
310
310
311
- **pin** The pin number *(uint8_t)*
311
312
312
-
- **channel** This optional parameter is used to attach the pin to a specific channel *(uint8_t)*)
313
+
- **ch** This optional parameter is used to attach the pin to a specific channel *(uint8_t)*)
313
314
314
-
- **minUs** Minimum timer width in microseconds *(uint16_t)*
315
-
316
-
- **defUs** Default timer width in microseconds *(uint16_t)*
315
+
- **minUs** Minimum timer width in microseconds *(uint16_t)
317
316
318
317
- **maxUs** Maximum timer width in microseconds *(uint16_t)*
319
318
@@ -336,6 +335,33 @@ attach(pin, ch, minUs, defUs, maxUs, speed, ke, invert) // as above with invert
336
335
337
336
338
337
338
+
### attachInvert()
339
+
340
+
##### Description
341
+
342
+
This function allows auto-attaching a pin to the first available channel if only the pin is specified. To have the pin assigned to a specific channel, use both the pin and channel (ch) parameters. The pwm output will be inverted. The duty value represents the low period.
343
+
344
+
**Syntax**
345
+
346
+
```c++
347
+
attachInvert(pin); // attach pin to next free channel with inverted pwm
348
+
attachInvert(pin, ch); // attach to specified ch with inverted pwm
349
+
```
350
+
351
+
##### Parameters
352
+
353
+
-**pin** The pin number *(uint8_t)*
354
+
-**ch** This optional parameter is used to attach the pin to a specific channel *(uint8_t)*)
355
+
356
+
##### Returns
357
+
358
+
- If not a valid pin, 254 *(uint8_t)*
359
+
- free channels exist, 253 *(uint8_t)*
360
+
- If attached, the channel number (0-15) *(uint8_t)*
0 commit comments