{"id":353,"date":"2026-07-19T10:00:31","date_gmt":"2026-07-19T03:00:31","guid":{"rendered":"https:\/\/navy007.com\/WP\/?p=353"},"modified":"2026-07-19T10:00:31","modified_gmt":"2026-07-19T03:00:31","slug":"esp32-ep-5-esp32-%e0%b8%81%e0%b8%b1%e0%b8%9a%e0%b8%87%e0%b8%b2%e0%b8%99-pwm","status":"publish","type":"post","link":"https:\/\/navy007.com\/WP\/archives\/353","title":{"rendered":"ESP32 (EP.5) ESP32 \u0e01\u0e31\u0e1a\u0e07\u0e32\u0e19 PWM"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e08\u0e30\u0e02\u0e2d\u0e40\u0e2a\u0e19\u0e2d\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 ESP32 \u0e43\u0e19\u0e07\u0e32\u0e19 PWM &#8230;. PWM \u0e22\u0e48\u0e2d\u0e21\u0e32\u0e08\u0e32\u0e01 Pulse Width Modulation \u0e21\u0e31\u0e19\u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e25\u0e39\u0e01\u0e04\u0e25\u0e37\u0e48\u0e19\u0e2a\u0e35\u0e48\u0e40\u0e2b\u0e25\u0e35\u0e48\u0e22\u0e21\u0e43\u0e19\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e15\u0e48\u0e32\u0e07 \u0e46 \u0e41\u0e25\u0e30\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e04\u0e48\u0e32\u0e02\u0e2d\u0e07 % duty cycle \u0e44\u0e14\u0e49&nbsp;&nbsp;\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14 PWM \u0e41\u0e1a\u0e1a\u0e19\u0e35\u0e49\u0e21\u0e35\u0e1b\u0e23\u0e30\u0e42\u0e22\u0e0a\u0e19\u0e4c\u0e2b\u0e25\u0e32\u0e22\u0e07\u0e32\u0e19\u0e41\u0e25\u0e49\u0e27\u0e41\u0e15\u0e48\u0e07\u0e32\u0e19\u0e17\u0e35\u0e48\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e08\u0e30\u0e17\u0e33\u0e04\u0e23\u0e31\u0e1a&nbsp;&nbsp;\u0e42\u0e14\u0e22\u0e2b\u0e25\u0e31\u0e01\u0e40\u0e25\u0e22\u0e01\u0e47\u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e04\u0e27\u0e1a\u0e04\u0e38\u0e21\u0e04\u0e27\u0e32\u0e21\u0e40\u0e23\u0e47\u0e27\u0e02\u0e2d\u0e07\u0e21\u0e2d\u0e40\u0e15\u0e2d\u0e23\u0e4c\u0e41\u0e1a\u0e1a BLDC \u0e41\u0e25\u0e30\u0e22\u0e31\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e01\u0e32\u0e23\u0e04\u0e27\u0e1a\u0e04\u0e38\u0e21\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e27\u0e48\u0e32\u0e07\u0e02\u0e2d\u0e07\u0e2b\u0e25\u0e2d\u0e14\u0e44\u0e1f\u0e02\u0e19\u0e32\u0e14\u0e40\u0e25\u0e47\u0e01\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e0a\u0e48\u0e19 LED \u0e44\u0e14\u0e49\u0e14\u0e49\u0e27\u0e22\u0e01\u0e32\u0e23\u0e1b\u0e49\u0e2d\u0e19 PWM \u0e40\u0e02\u0e49\u0e32\u0e44\u0e1b\u0e43\u0e19 LED \u0e14\u0e49\u0e27\u0e22 duty cycle \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07\u0e0a\u0e48\u0e27\u0e07 10 &#8211; 90% \u0e0b\u0e36\u0e48\u0e07\u0e08\u0e30\u0e17\u0e33\u0e43\u0e2b\u0e49 LED \u0e2a\u0e27\u0e48\u0e32\u0e07\u0e19\u0e49\u0e2d\u0e22\u0e16\u0e36\u0e07\u0e21\u0e32\u0e01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e01\u0e48\u0e2d\u0e19\u0e2d\u0e37\u0e48\u0e19\u0e21\u0e32\u0e14\u0e39\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e02\u0e2d\u0e07\u0e23\u0e39\u0e1b\u0e04\u0e25\u0e37\u0e48\u0e19 PWM \u0e01\u0e48\u0e2d\u0e19\u0e27\u0e48\u0e32\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e02\u0e2d\u0e07 duty cycle \u0e27\u0e48\u0e32\u0e21\u0e31\u0e19\u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e23&nbsp;&nbsp;\u0e08\u0e32\u0e01\u0e20\u0e32\u0e1e\u0e19\u0e35\u0e49\u0e08\u0e30\u0e40\u0e2b\u0e47\u0e19\u0e27\u0e48\u0e32\u0e23\u0e39\u0e1b\u0e04\u0e25\u0e37\u0e48\u0e19\u0e2a\u0e35\u0e48\u0e40\u0e2b\u0e25\u0e35\u0e48\u0e22\u0e21\u0e08\u0e30\u0e21\u0e35\u0e04\u0e27\u0e32\u0e21\u0e01\u0e27\u0e49\u0e32\u0e07\u0e0a\u0e48\u0e27\u0e07 ON \u0e41\u0e25\u0e30 OFF \u0e43\u0e19 1 \u0e0a\u0e48\u0e27\u0e07\u0e04\u0e25\u0e37\u0e48\u0e19&nbsp;&nbsp;\u0e16\u0e49\u0e32\u0e0a\u0e48\u0e27\u0e07 ON \u0e21\u0e35\u0e04\u0e48\u0e32\u0e19\u0e49\u0e2d\u0e22\u0e01\u0e47\u0e2b\u0e21\u0e32\u0e22\u0e04\u0e27\u0e32\u0e21\u0e27\u0e48\u0e32 % \u0e02\u0e2d\u0e07 duty cycle \u0e21\u0e35\u0e04\u0e48\u0e32\u0e15\u0e48\u0e33&nbsp;&nbsp;\u0e41\u0e25\u0e30\u0e2b\u0e32\u0e01\u0e0a\u0e48\u0e27\u0e07 ON \u0e01\u0e27\u0e49\u0e32\u0e07\u0e41\u0e25\u0e30\u0e0a\u0e48\u0e27\u0e07 OFF \u0e41\u0e04\u0e1a\u0e19\u0e34\u0e14\u0e40\u0e14\u0e35\u0e22\u0e27\u0e01\u0e47\u0e04\u0e37\u0e2d\u0e23\u0e39\u0e1b\u0e04\u0e25\u0e37\u0e48\u0e19\u0e19\u0e31\u0e49\u0e19\u0e21\u0e35 % \u0e02\u0e2d\u0e07 duty cycle \u0e2a\u0e39\u0e07\u0e04\u0e23\u0e31\u0e1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/f.ptcdn.info\/757\/091\/000\/mrr5yeat1kc1Tu9usx4N6x-o.png\" alt=\"\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e43\u0e19 ESP32 \u0e08\u0e30\u0e21\u0e35 hardware \u0e17\u0e35\u0e48\u0e17\u0e33\u0e2b\u0e19\u0e49\u0e32\u0e17\u0e35\u0e48\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14 PWM \u0e42\u0e14\u0e22\u0e40\u0e09\u0e1e\u0e32\u0e30&nbsp;&nbsp;\u0e19\u0e31\u0e48\u0e19\u0e01\u0e47\u0e2b\u0e21\u0e32\u0e22\u0e04\u0e27\u0e32\u0e21\u0e27\u0e48\u0e32\u0e43\u0e19\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14 PWM \u0e08\u0e30\u0e44\u0e21\u0e48\u0e01\u0e34\u0e19\u0e01\u0e33\u0e25\u0e31\u0e07 CPU \u0e02\u0e2d\u0e07 ESP32 \u0e40\u0e25\u0e22\u0e40\u0e1e\u0e23\u0e32\u0e30\u0e21\u0e31\u0e19\u0e40\u0e1b\u0e47\u0e19 dedicated hardware \u0e0b\u0e36\u0e48\u0e07\u0e08\u0e30\u0e41\u0e1a\u0e48\u0e07\u0e40\u0e1b\u0e47\u0e19 2 \u0e2a\u0e48\u0e27\u0e19\u0e01\u0e47\u0e04\u0e37\u0e2d<br>\ud83d\uded1&nbsp;&nbsp;LEDC (LED Controller)&nbsp;&nbsp;\u0e40\u0e1b\u0e47\u0e19\u0e2a\u0e48\u0e27\u0e19\u0e02\u0e2d\u0e07 hardware \u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e41\u0e1a\u0e1a\u0e2a\u0e33\u0e2b\u0e23\u0e31\u0e1a\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e41\u0e1a\u0e1a basic \u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e19\u0e33\u0e44\u0e1b\u0e04\u0e38\u0e21\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e27\u0e48\u0e32\u0e07\u0e02\u0e2d\u0e07 LED \u0e01\u0e47\u0e44\u0e14\u0e49 \u0e2b\u0e23\u0e37\u0e2d\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e04\u0e25\u0e37\u0e48\u0e19\u0e2a\u0e35\u0e48\u0e40\u0e2b\u0e25\u0e35\u0e48\u0e22\u0e21\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19\u0e2d\u0e40\u0e19\u0e01\u0e1b\u0e23\u0e30\u0e2a\u0e07\u0e04\u0e4c\u0e43\u0e14 \u0e46 \u0e01\u0e47\u0e44\u0e14\u0e49\u0e42\u0e14\u0e22\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1b\u0e23\u0e31\u0e1a duty cycle \u0e44\u0e14\u0e49\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e2d\u0e34\u0e2a\u0e23\u0e30&nbsp;&nbsp;\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e43\u0e19\u0e42\u0e1b\u0e23\u0e40\u0e08\u0e04\u0e17\u0e35\u0e48\u0e1c\u0e21\u0e08\u0e30\u0e2a\u0e32\u0e18\u0e34\u0e15\u0e14\u0e49\u0e32\u0e19\u0e25\u0e48\u0e32\u0e07\u0e19\u0e35\u0e49\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e44\u0e14\u0e49\u0e01\u0e27\u0e49\u0e32\u0e07\u0e21\u0e32\u0e01\u0e16\u0e36\u0e07 5 Hz &#8211; 1 MHz \u0e41\u0e25\u0e30\u0e1b\u0e23\u0e31\u0e1a duty cycle \u0e44\u0e14\u0e49\u0e01\u0e27\u0e49\u0e32\u0e07\u0e43\u0e19\u0e0a\u0e48\u0e27\u0e07 5 &#8211; 95% \u0e42\u0e14\u0e22\u0e17\u0e33\u0e07\u0e32\u0e19\u0e1c\u0e48\u0e32\u0e19 web dashboard<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\ud83d\uded1 MCPWM (Motor Control Pulse Width Modulator)&nbsp;&nbsp;\u0e2a\u0e48\u0e27\u0e19\u0e19\u0e35\u0e49\u0e08\u0e30\u0e17\u0e33\u0e07\u0e32\u0e19\u0e04\u0e48\u0e2d\u0e19\u0e02\u0e49\u0e32\u0e07\u0e0b\u0e31\u0e1a\u0e0b\u0e49\u0e2d\u0e19\u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e08\u0e32\u0e01\u0e2d\u0e2d\u0e01\u0e41\u0e1a\u0e1a\u0e43\u0e2b\u0e49\u0e04\u0e27\u0e1a\u0e04\u0e38\u0e21\u0e21\u0e2d\u0e40\u0e15\u0e2d\u0e23\u0e4c\u0e41\u0e1a\u0e1a 3 \u0e40\u0e1f\u0e2a&nbsp;&nbsp;\u0e14\u0e31\u0e07\u0e19\u0e31\u0e49\u0e19\u0e08\u0e36\u0e07\u0e43\u0e2b\u0e49 output \u0e44\u0e14\u0e49\u0e16\u0e36\u0e07 3 \u0e0a\u0e38\u0e14\u0e41\u0e25\u0e30\u0e21\u0e35\u0e02\u0e32\u0e23\u0e2d\u0e07\u0e23\u0e31\u0e1a\u0e01\u0e32\u0e23\u0e1b\u0e49\u0e2d\u0e19\u0e01\u0e25\u0e31\u0e1a\u0e08\u0e32\u0e01\u0e15\u0e31\u0e27\u0e21\u0e2d\u0e40\u0e15\u0e2d\u0e23\u0e4c\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e2a\u0e23\u0e49\u0e32\u0e07 timing \u0e17\u0e35\u0e48\u0e41\u0e21\u0e48\u0e19\u0e22\u0e33<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/f.ptcdn.info\/757\/091\/000\/mrr5zemp1l3tvPrkDuFq-o.png\" alt=\"\"\/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e15\u0e48\u0e2d\u0e44\u0e1b\u0e08\u0e30\u0e27\u0e48\u0e32\u0e14\u0e49\u0e27\u0e22\u0e02\u0e49\u0e2d\u0e08\u0e33\u0e01\u0e31\u0e14\u0e02\u0e2d\u0e07\u0e43\u0e19\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14 PWM &#8230;. \u0e40\u0e19\u0e37\u0e48\u0e2d\u0e07\u0e08\u0e32\u0e01 ESP32 \u0e17\u0e33\u0e07\u0e32\u0e19\u0e14\u0e49\u0e27\u0e22\u0e2a\u0e31\u0e0d\u0e0d\u0e32\u0e13\u0e19\u0e32\u0e2c\u0e34\u0e01\u0e32 clock \u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48 80 MHz \u0e08\u0e32\u0e01 APB (Advanced Peripheral Bus)&nbsp;&nbsp;\u0e14\u0e31\u0e07\u0e19\u0e31\u0e49\u0e19\u0e08\u0e36\u0e07\u0e21\u0e35\u0e02\u0e49\u0e2d\u0e08\u0e33\u0e01\u0e31\u0e14\u0e2d\u0e22\u0e39\u0e48\u0e40\u0e25\u0e47\u0e01\u0e19\u0e49\u0e2d\u0e22\u0e43\u0e19\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e17\u0e35\u0e48\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e2a\u0e39\u0e07\u0e23\u0e30\u0e14\u0e31\u0e1a 1 MHz \u0e2b\u0e23\u0e37\u0e2d\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13\u0e19\u0e35\u0e49&nbsp;&nbsp;\u0e2a\u0e34\u0e48\u0e07\u0e17\u0e35\u0e48\u0e27\u0e48\u0e32\u0e19\u0e35\u0e49\u0e01\u0e47\u0e04\u0e37\u0e2d Resolution \u0e02\u0e2d\u0e07 duty cycle<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e08\u0e32\u0e01 clock 80 MHz \u0e02\u0e2d\u0e07 ESP32 \u0e40\u0e21\u0e37\u0e48\u0e2d LEDC \u0e17\u0e33\u0e07\u0e32\u0e19\u0e20\u0e32\u0e22\u0e43\u0e19\u0e15\u0e31\u0e27\u0e08\u0e30\u0e21\u0e35 counter \u0e20\u0e32\u0e22\u0e43\u0e19&nbsp;&nbsp;\u0e2b\u0e32\u0e01\u0e40\u0e23\u0e32\u0e01\u0e33\u0e2b\u0e19\u0e14\u0e43\u0e2b\u0e49\u0e2a\u0e23\u0e49\u0e32\u0e07\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48 1 MHz&nbsp;&nbsp;\u0e15\u0e31\u0e27 counter \u0e02\u0e2d\u0e07 LEDC \u0e01\u0e47\u0e08\u0e30\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e19\u0e31\u0e1a\u0e44\u0e14\u0e49\u0e40\u0e17\u0e48\u0e32\u0e01\u0e31\u0e1a 80 ticks \u0e0b\u0e36\u0e48\u0e07\u0e08\u0e33\u0e19\u0e27\u0e19 80 ticks \u0e17\u0e35\u0e48\u0e19\u0e31\u0e1a\u0e44\u0e14\u0e49\u0e19\u0e35\u0e49\u0e04\u0e48\u0e32\u0e02\u0e2d\u0e07 resolution \u0e01\u0e47\u0e08\u0e30\u0e21\u0e35\u0e04\u0e48\u0e32\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 6 bit&nbsp;&nbsp;\u0e15\u0e32\u0e21\u0e2a\u0e21\u0e01\u0e32\u0e23 log \u0e19\u0e35\u0e49<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/f.ptcdn.info\/757\/091\/000\/mrr60xtm1vv57Cqbxj4t3b-o.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e41\u0e25\u0e30\u0e2b\u0e32\u0e01\u0e40\u0e23\u0e32\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e17\u0e35\u0e48\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e15\u0e48\u0e33\u0e01\u0e27\u0e48\u0e32\u0e19\u0e35\u0e49\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e0a\u0e48\u0e19 40 KHz&nbsp;&nbsp;\u0e04\u0e48\u0e32 resolution \u0e01\u0e47\u0e08\u0e30\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 10 bit<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e04\u0e48\u0e32 resolution \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e47\u0e19\u0e08\u0e33\u0e19\u0e27\u0e19 bit \u0e19\u0e35\u0e49\u0e21\u0e31\u0e19\u0e2b\u0e21\u0e32\u0e22\u0e04\u0e27\u0e32\u0e21\u0e16\u0e36\u0e07 step \u0e02\u0e2d\u0e07 duty cycle \u0e17\u0e35\u0e48\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e17\u0e33\u0e44\u0e14\u0e49 \u0e2d\u0e22\u0e48\u0e32\u0e07\u0e17\u0e35\u0e48\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48 1 MHz = resolution \u0e40\u0e17\u0e48\u0e32\u0e01\u0e31\u0e1a 6 bit&nbsp;&nbsp;\u0e14\u0e31\u0e07\u0e19\u0e31\u0e49\u0e19 steps \u0e02\u0e2d\u0e07\u0e04\u0e48\u0e32 duty cycle \u0e17\u0e35\u0e48\u0e08\u0e30\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e44\u0e14\u0e49\u0e01\u0e47\u0e08\u0e30 = 2<sup>6<\/sup>&nbsp;= 64 steps&nbsp;&nbsp;\u0e01\u0e47\u0e04\u0e37\u0e2d duty cycle 0 &#8211; 100% \u0e08\u0e30\u0e40\u0e23\u0e34\u0e48\u0e21\u0e15\u0e49\u0e19\u0e08\u0e32\u0e01 (100\/64) = 1.5625% \u2192 3.125 \u2192 4.6875&nbsp;&nbsp;6.25&nbsp;&nbsp;7.8125&nbsp;&nbsp;9.375 &#8230;. 50&nbsp;&nbsp;51.5625 \u0e44\u0e1b\u0e08\u0e19\u0e16\u0e36\u0e07 98.4375 %<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e41\u0e25\u0e30\u0e2b\u0e32\u0e01\u0e17\u0e35\u0e48\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e15\u0e48\u0e33\u0e01\u0e27\u0e48\u0e32\u0e19\u0e35\u0e49\u0e40\u0e0a\u0e48\u0e19 40 KHz&nbsp;&nbsp;\u0e04\u0e48\u0e32 resolution \u0e01\u0e47\u0e08\u0e30\u0e1b\u0e23\u0e30\u0e21\u0e32\u0e13 10 bit \u0e41\u0e25\u0e30\u0e2b\u0e32\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e15\u0e48\u0e33\u0e25\u0e07\u0e44\u0e1b\u0e2d\u0e35\u0e01\u0e01\u0e47\u0e08\u0e30\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1b\u0e23\u0e31\u0e1a step \u0e02\u0e2d\u0e07 duty cycle \u0e44\u0e14\u0e49\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e21\u0e32\u0e01\u0e01\u0e27\u0e48\u0e32\u0e19\u0e35\u0e49\u0e2d\u0e35\u0e01\u0e41\u0e15\u0e48\u0e01\u0e47\u0e2a\u0e39\u0e07\u0e2a\u0e38\u0e14\u0e01\u0e47\u0e04\u0e37\u0e2d 16 bit \u0e04\u0e23\u0e31\u0e1a&nbsp;&nbsp;0.09765625 \u2192 0.1953125 \u2192 0.29296875 \u2192 0.390625 &#8230;. \u0e0b\u0e36\u0e48\u0e07\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e21\u0e32\u0e01<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e43\u0e19\u0e04\u0e25\u0e34\u0e1b\u0e17\u0e35\u0e48\u0e17\u0e48\u0e32\u0e19\u0e40\u0e2b\u0e47\u0e19\u0e14\u0e49\u0e32\u0e19\u0e25\u0e48\u0e32\u0e07\u0e19\u0e35\u0e49\u0e04\u0e37\u0e2d\u0e44\u0e1f\u0e27\u0e34\u0e48\u0e07\u0e17\u0e35\u0e48\u0e2d\u0e2d\u0e01\u0e41\u0e1a\u0e1a\u0e43\u0e2b\u0e49\u0e01\u0e32\u0e23\u0e27\u0e34\u0e48\u0e07\u0e02\u0e2d\u0e07 LED 5 \u0e14\u0e27\u0e07\u0e19\u0e35\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e44\u0e1b\u0e41\u0e1a\u0e1a smooth fade \u0e19\u0e31\u0e48\u0e19\u0e01\u0e47\u0e04\u0e37\u0e2d\u0e43\u0e0a\u0e49 PWM \u0e21\u0e32\u0e0a\u0e48\u0e27\u0e22\u0e04\u0e23\u0e31\u0e1a \u0e42\u0e14\u0e22\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e08\u0e32\u0e01\u0e01\u0e32\u0e23\u0e01\u0e23\u0e30\u0e1e\u0e23\u0e34\u0e1a\u0e18\u0e23\u0e23\u0e21\u0e14\u0e32\u0e04\u0e37\u0e2d\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e08\u0e32\u0e01 logic 1 \u0e41\u0e25\u0e30 0 \u0e02\u0e2d\u0e07 GPIO \u0e43\u0e2b\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14 PWM \u0e2d\u0e2d\u0e01\u0e21\u0e32\u0e08\u0e32\u0e01 GPIO \u0e17\u0e31\u0e49\u0e07 5 \u0e02\u0e32 \u0e42\u0e14\u0e22\u0e43\u0e19\u0e0a\u0e48\u0e27\u0e07\u0e01\u0e32\u0e23\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e01\u0e32\u0e23\u0e27\u0e34\u0e48\u0e07\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07 LED \u0e41\u0e15\u0e48\u0e25\u0e30\u0e14\u0e27\u0e07\u0e01\u0e47\u0e1b\u0e49\u0e2d\u0e19 PWM \u0e17\u0e35\u0e48\u0e21\u0e35 duty cycle \u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07 10 &#8211; 90% \u0e17\u0e33\u0e43\u0e2b\u0e49\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e02\u0e2d\u0e07\u0e44\u0e1f\u0e27\u0e34\u0e48\u0e07\u0e08\u0e30\u0e14\u0e39\u0e19\u0e38\u0e48\u0e21\u0e19\u0e27\u0e25\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e17\u0e35\u0e48\u0e40\u0e2b\u0e47\u0e19\u0e04\u0e23\u0e31\u0e1a<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u0e44\u0e1f\u0e27\u0e34\u0e48\u0e07 Running LED 5 \u0e14\u0e27\u0e07 + PWM\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/q7hxJXam_nc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>\u0e2d\u0e38\u0e1b\u0e01\u0e23\u0e13\u0e4c\u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e21\u0e35\u0e40\u0e1e\u0e35\u0e22\u0e07\u0e40\u0e17\u0e48\u0e32\u0e19\u0e35\u0e49<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/f.ptcdn.info\/757\/091\/000\/mrr67hi5hn7DIecHK7P-o.jpg\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Code \u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14\u0e02\u0e2d\u0e07\u0e44\u0e1f\u0e27\u0e34\u0e48\u0e07 PWM<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Define Pins for both groups\nconst int pinsGroupA&#91;] = {21, 38, 39}; \/\/ 3 LEDs (Simple ON\/OFF running)\nconst int numGroupA = 3;\n\nconst int pinsGroupB&#91;] = {4, 5, 6, 7, 8}; \/\/ 5 LEDs (Smooth PWM Fading)\nconst int numGroupB = 5;\n\nconst int potPin = 1;\n\n\/\/ PWM Settings for ESP32-S3 (Core 3.x)\nconst int pwmFreq = 5000;       \/\/ 5 kHz PWM frequency\nconst int pwmResolution = 8;    \/\/ 8-bit resolution (0 - 255 brightness)\nconst int maxBrightness = 255;\n\n\/\/ State Machine States\nenum RunState {\n  MODE_THREE_LEDS,\n  MODE_FIVE_LEDS\n};\nRunState currentState = MODE_THREE_LEDS;\n\n\/\/ Sequencer Variables\nint currentLedIdx = 0;\nint previousLedIdx = -1;\nint cycleCount = 0;\n\nunsigned long lastRunMillis = 0;\nunsigned long lastFadeMillis = 0;\nconst int fadeInterval = 5; \/\/ Update fade every 5ms\nfloat fadeProgress = 0.0;\n\nvoid setup() {\n  \/\/ Initialize Group A (3 LEDs) as standard digital outputs\n  for (int i = 0; i &lt; numGroupA; i++) {\n    pinMode(pinsGroupA&#91;i], OUTPUT);\n    digitalWrite(pinsGroupA&#91;i], LOW);\n  }\n\n  \/\/ Initialize Group B (5 LEDs) using the Core 3.x PWM API\n  for (int i = 0; i &lt; numGroupB; i++) {\n    ledcAttach(pinsGroupB&#91;i], pwmFreq, pwmResolution);\n    ledcWrite(pinsGroupB&#91;i], 0);\n  }\n  \n  analogReadResolution(12); \/\/ 12-bit ADC (0-4095)\n}\n\nvoid loop() {\n  unsigned long currentMillis = millis();\n\n  \/\/ --- STATE 1: 3 LEDs Running at Fixed 3 Hz ---\n  if (currentState == MODE_THREE_LEDS) {\n    unsigned long runIntervalA = 1000 \/ 3; \/\/ Fixed 3 Hz frequency -> ~333ms per step\n\n    if (currentMillis - lastRunMillis >= runIntervalA) {\n      lastRunMillis = currentMillis;\n\n      \/\/ Turn off previous LED\n      if (previousLedIdx != -1) {\n        digitalWrite(pinsGroupA&#91;previousLedIdx], LOW);\n      }\n      \n      \/\/ Turn on current LED\n      digitalWrite(pinsGroupA&#91;currentLedIdx], HIGH);\n\n      \/\/ Track sequencing indices\n      previousLedIdx = currentLedIdx;\n      currentLedIdx++;\n\n      \/\/ Check if one full cycle of 3 LEDs is complete\n      if (currentLedIdx >= numGroupA) {\n        currentLedIdx = 0;\n        cycleCount++;\n\n        \/\/ If 3 complete cycles are reached, reset and switch state\n        if (cycleCount >= 3) {\n          \/\/ Clean up Group A states\n          digitalWrite(pinsGroupA&#91;previousLedIdx], LOW);\n         \n          \/\/ Switch to Group B\n          currentState = MODE_FIVE_LEDS;\n          cycleCount = 0;\n          currentLedIdx = 0;\n          previousLedIdx = numGroupB - 1; \/\/ Prepare fading index for Group B\n          fadeProgress = 0.0;\n        }\n      }\n    }\n  }\n\n  \/\/ --- STATE 2: 5 LEDs Running with Smooth Fade + Variable POT Speed ---\n  else if (currentState == MODE_FIVE_LEDS) {\n    \/\/ Read POT to calculate variable frequency (1Hz to 5Hz)\n    int potValue = analogRead(potPin);\n    float frequency = map(potValue, 0, 4095, 100, 500) \/ 100.0;\n    unsigned long runIntervalB = 1000 \/ frequency; \/\/ Dynamic step time based on frequency\n\n    \/\/ A. Handle Smooth Fading Calculations (Every 5ms)\n    if (currentMillis - lastFadeMillis >= fadeInterval) {\n      lastFadeMillis = currentMillis;\n\n      unsigned long timePassed = currentMillis - lastRunMillis;\n      fadeProgress = (float)timePassed \/ (float)runIntervalB;\n      if (fadeProgress > 1.0) fadeProgress = 1.0;\n\n      int fadeInDuty = fadeProgress * maxBrightness;\n      int fadeOutDuty = (1.0 - fadeProgress) * maxBrightness;\n\n      \/\/ Apply smooth PWM fading to current and previous LEDs\n      ledcWrite(pinsGroupB&#91;currentLedIdx], fadeInDuty);\n      ledcWrite(pinsGroupB&#91;previousLedIdx], fadeOutDuty);\n    }\n\n    \/\/ B. Handle stepping to the next LED in Group B\n    if (currentMillis - lastRunMillis >= runIntervalB) {\n      lastRunMillis = currentMillis;\n\n      \/\/ Ensure clean final values for step transition\n      ledcWrite(pinsGroupB&#91;previousLedIdx], 0);\n      ledcWrite(pinsGroupB&#91;currentLedIdx], maxBrightness);\n\n      previousLedIdx = currentLedIdx;\n      currentLedIdx++;\n\n      \/\/ Check if one full cycle of 5 LEDs is complete\n      if (currentLedIdx >= numGroupB) {\n        currentLedIdx = 0;\n        cycleCount++;\n\n        \/\/ If 3 complete cycles are reached, reset and switch state back to Group A\n        if (cycleCount >= 3) {\n          \/\/ Clean up Group B states\n          ledcWrite(pinsGroupB&#91;previousLedIdx], 0);\n\n          \/\/ Switch to Group A\n          currentState = MODE_THREE_LEDS;\n          cycleCount = 0;\n          currentLedIdx = 0;\n          previousLedIdx = -1; \/\/ Reset to safe initial value for Group A\n        }\n      }\n      \n      fadeProgress = 0.0; \/\/ Reset fade progress for the new step\n    }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u0e15\u0e48\u0e2d\u0e44\u0e1b\u0e04\u0e37\u0e2d project \u0e08\u0e23\u0e34\u0e07\u0e17\u0e35\u0e48\u0e43\u0e0a\u0e49\u0e1b\u0e23\u0e30\u0e42\u0e22\u0e0a\u0e19\u0e4c\u0e2a\u0e39\u0e07\u0e2a\u0e38\u0e14\u0e08\u0e32\u0e01\u0e02\u0e2d\u0e07 PWM \u0e42\u0e14\u0e22\u0e2d\u0e2d\u0e01\u0e41\u0e1a\u0e1a\u0e43\u0e2b\u0e49\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e43\u0e19\u0e0a\u0e48\u0e27\u0e07\u0e01\u0e27\u0e49\u0e32\u0e07\u0e21\u0e32\u0e01\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07 5 Hz &#8211; 1 MHz \u0e41\u0e25\u0e30\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e1b\u0e23\u0e31\u0e1a duty cycle \u0e44\u0e14\u0e49\u0e0a\u0e48\u0e27\u0e07\u0e01\u0e27\u0e49\u0e32\u0e07\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07 5 &#8211; 95% \u0e04\u0e23\u0e31\u0e1a\u0e41\u0e25\u0e30\u0e40\u0e1e\u0e37\u0e48\u0e2d\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e30\u0e14\u0e27\u0e01\u0e01\u0e47\u0e2d\u0e2d\u0e01\u0e41\u0e1a\u0e1a\u0e43\u0e2b\u0e49\u0e23\u0e31\u0e1a\u0e04\u0e48\u0e32\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e41\u0e25\u0e30 duty cycle \u0e08\u0e32\u0e01 web dashboard \u0e44\u0e14\u0e49\u0e40\u0e25\u0e22\u0e14\u0e39\u0e23\u0e32\u0e22\u0e25\u0e30\u0e40\u0e2d\u0e35\u0e22\u0e14\u0e43\u0e19\u0e04\u0e25\u0e34\u0e1b\u0e04\u0e23\u0e31\u0e1a<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49 ESP32 \u0e01\u0e31\u0e1a\u0e07\u0e32\u0e19 PWM\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/HKkq8QdxY4g?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><br>Code \u0e17\u0e31\u0e49\u0e07\u0e2b\u0e21\u0e14\u0e02\u0e2d\u0e07 PWM generator + web dashboard<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;WiFi.h>\n#include &lt;WebServer.h>\n\n\/\/ --- WiFi Credentials ---\nconst char* ssid = \" SSID \u0e02\u0e2d\u0e07 Wi-Fi \u0e17\u0e48\u0e32\u0e19\";\nconst char* password = \" password \u0e02\u0e2d\u0e07 Wi-Fi \u0e17\u0e48\u0e32\u0e19 \";\n\n\/\/ --- Hardware Settings ---\nconst uint8_t PWM_PIN = 11;\nuint32_t currentFreq = 1000; \/\/ Default 1 kHz\nuint8_t currentDuty = 50;    \/\/ Default 50%\n\nWebServer server(80);\n\n\/\/ --- HTML\/CSS\/JS Dashboard ---\n\/\/ Stored in program memory (PROGMEM) to save RAM\nconst char index_html&#91;] PROGMEM = R\"rawliteral(\n&lt;!DOCTYPE html>\n&lt;html>\n&lt;head>\n  &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  &lt;title>ESP32-S3 PWM Controller&lt;\/title>\n  &lt;style>\n    body { font-family: Arial, sans-serif; text-align: center; background-color: #f4f4f9; padding: 20px; }\n    .card { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); display: inline-block; max-width: 100%; overflow-x: hidden; }\n    h2 { color: #333; }\n    .slider-container { margin: 30px 0; }\n    input&#91;type=range] { width: 100%; max-width: 400px; }\n    \n    \/* PC Specific styling: 1200px wide sliders *\/\n    @media (min-width: 1024px) {\n      input&#91;type=range] { width: 1200px; max-width: 1200px; }\n      .card { max-width: 1300px; }\n    }\n    slider\n    .value-label { font-size: 1.2em; font-weight: bold; color: #0066cc; }\n    input&#91;type=number] { padding: 10px; font-size: 1em; width: 150px; text-align: center; border: 1px solid #ccc; border-radius: 5px; }\n    button { padding: 10px 20px; font-size: 1em; background-color: #0066cc; color: white; border: none; border-radius: 5px; cursor: pointer; }\n    button:hover { background-color: #004c99; }\n  &lt;\/style>\n&lt;\/head>\n&lt;body>\n  &lt;div class=\"card\">\n    &lt;h2>ESP32-S3 PWM Dashboard&lt;\/h2>\n    \n    &lt;div class=\"slider-container\">\n      &lt;h3>Frequency (Hz)&lt;\/h3>\n      &lt;input type=\"range\" id=\"freqSlider\" min=\"1\" max=\"1000000\" value=\"1000\" oninput=\"updateFreqFromSlider()\">\n      &lt;br>&lt;br>\n      &lt;input type=\"number\" id=\"freqInput\" min=\"1\" max=\"1000000\" value=\"1000\" oninput=\"updateFreqFromInput()\">\n      &lt;button onclick=\"executeSend()\">Send&lt;\/button>\n    &lt;\/div>\n\n    &lt;hr>\n\n    &lt;div class=\"slider-container\">\n      &lt;h3>Duty Cycle (%)&lt;\/h3>\n      &lt;input type=\"range\" id=\"dutySlider\" min=\"5\" max=\"95\" step=\"5\" value=\"50\" oninput=\"onDutySlide()\">\n      &lt;p class=\"value-label\">&lt;span id=\"dutyLabel\">50&lt;\/span>%&lt;\/p>\n    &lt;\/div>\n  &lt;\/div>\n\n  &lt;script>\n    let canSend = true;\n\n    \/\/ Sync input box when slider moves and throttle network request\n    function updateFreqFromSlider() {\n      document.getElementById(\"freqInput\").value = document.getElementById(\"freqSlider\").value;\n      throttleSend();\n    }\n\n    \/\/ Sync slider when input box changes (User types value)\n    function updateFreqFromInput() {\n      let val = document.getElementById(\"freqInput\").value;\n      \/\/ Clamp values between 1 and 1,000,000\n      if(val &lt; 1) val = 1;\n      if(val > 1000000) val = 1000000;\n      document.getElementById(\"freqSlider\").value = val;\n    }\n\n    \/\/ Update duty label and throttle network request\n    function onDutySlide() {\n      document.getElementById(\"dutyLabel\").innerText = document.getElementById(\"dutySlider\").value;\n      throttleSend();\n    }\n\n    \/\/ Ensures we only send HTTP GET every 1 second maximum while sliding\n    function throttleSend() {\n      if(canSend) {\n        executeSend();\n        canSend = false;\n        setTimeout(() => { canSend = true; }, 1000); \/\/ 1000ms = 1 second\n      }\n    }\n\n    \/\/ The actual HTTP GET request\n    function executeSend() {\n      let f = document.getElementById(\"freqInput\").value;\n      let d = document.getElementById(\"dutySlider\").value;\n      \n      fetch(`\/update?freq=${f}&amp;duty=${d}`)\n        .then(response => { console.log(\"PWM Updated\"); })\n        .catch(error => { console.error(\"Error updating PWM\", error); });\n    }\n  &lt;\/script>\n&lt;\/body>\n&lt;\/html>\n)rawliteral\";\n\n\/\/ --- Function to update hardware PWM based on ESP32 Core v3.x API ---\n\/\/ --- Function to update hardware PWM based on ESP32 Core v3.x API ---\nvoid setPWM(uint32_t freq, uint8_t dutyPercent) {\n  \/\/ 1. Calculate the maximum bit resolution for this frequency\n  uint8_t resolution = log2(80000000 \/ freq);\n  \n  \/\/ Clamp resolution to a maximum of 14 bits for stability, and minimum of 1 bit\n  if (resolution > 14) resolution = 14;\n  if (resolution &lt; 1) resolution = 1;\n\n  \/\/ 2. THE FIX: Update frequency dynamically\n  \/\/ ledcChangeFrequency returns 0 if the pin hasn't been attached yet.\n  \/\/ So if it fails (like during the first run in setup()), we use ledcAttach instead.\n  if (ledcChangeFrequency(PWM_PIN, freq, resolution) == 0) {\n    ledcAttach(PWM_PIN, freq, resolution);\n  }\n\n  \/\/ 3. Convert the percentage (5-95%) into the raw hardware value based on resolution\n  uint32_t max_duty_value = (1 &lt;&lt; resolution) - 1;\n  uint32_t raw_duty = (dutyPercent * max_duty_value) \/ 100;\n\n  \/\/ 4. Write the value to the hardware\n  ledcWrite(PWM_PIN, raw_duty);\n  \n  Serial.printf(\"Set PWM -> Freq: %d Hz | Duty: %d%% | Res: %d-bit | Raw Duty: %d\/%d\\n\",\n                freq, dutyPercent, resolution, raw_duty, max_duty_value);\n}\n\nvoid setup() {\n  Serial.begin(115200);\n  ledcSetClockSource(LEDC_USE_APB_CLK);\n  \/\/ Initialize PWM with default values\n  setPWM(currentFreq, currentDuty);\n\n  \/\/ Connect to Wi-Fi\n  Serial.print(\"Connecting to WiFi: \");\n  Serial.println(ssid);\n  WiFi.mode(WIFI_STA);\n  WiFi.begin(ssid, password);\n  \n  while (WiFi.status() != WL_CONNECTED) {\n    delay(500);\n    Serial.print(\".\");\n  }\n  Serial.println(\"\\nWiFi Connected!\");\n  Serial.print(\"IP Address: \");\n  Serial.println(WiFi.localIP());\n\n  \/\/ --- Web Server Routes ---\n  \n  \/\/ 1. Serve the Dashboard\n  server.on(\"\/\", &#91;]() {\n    server.send(200, \"text\/html\", index_html);\n  });\n\n  \/\/ 2. Handle the HTTP GET request from JS (e.g. \/update?freq=500000&amp;duty=45)\n  server.on(\"\/update\", &#91;]() {\n    if (server.hasArg(\"freq\") &amp;&amp; server.hasArg(\"duty\")) {\n      currentFreq = server.arg(\"freq\").toInt();\n      currentDuty = server.arg(\"duty\").toInt();\n      \n      \/\/ Safety clamps\n      if(currentFreq &lt; 1) currentFreq = 1;\n      if(currentFreq > 1000000) currentFreq = 1000000;\n      if(currentDuty &lt; 5) currentDuty = 5;\n      if(currentDuty > 95) currentDuty = 95;\n\n      setPWM(currentFreq, currentDuty);\n      server.send(200, \"text\/plain\", \"OK\");\n    } else {\n      server.send(400, \"text\/plain\", \"Missing parameters\");\n    }\n  });\n\n  server.begin();\n  Serial.println(\"HTTP server started\");\n}\n\nvoid loop() {\n  \/\/ Listen for incoming web requests\n  server.handleClient();\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0e27\u0e31\u0e19\u0e19\u0e35\u0e49\u0e08\u0e30\u0e02\u0e2d\u0e40\u0e2a\u0e19\u0e2d\u0e01\u0e32\u0e23\u0e43\u0e0a\u0e49\u0e07\u0e32\u0e19 ESP32 \u0e43\u0e19\u0e07\u0e32\u0e19 PWM &#8230;. PWM \u0e22\u0e48\u0e2d\u0e21\u0e32\u0e08\u0e32\u0e01 Pulse Width Modulation \u0e21\u0e31\u0e19\u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14\u0e25\u0e39\u0e01\u0e04\u0e25\u0e37\u0e48\u0e19\u0e2a\u0e35\u0e48\u0e40\u0e2b\u0e25\u0e35\u0e48\u0e22\u0e21\u0e43\u0e19\u0e04\u0e27\u0e32\u0e21\u0e16\u0e35\u0e48\u0e15\u0e48\u0e32\u0e07 \u0e46 \u0e41\u0e25\u0e30\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e04\u0e48\u0e32\u0e02\u0e2d\u0e07 % duty cycle \u0e44\u0e14\u0e49&nbsp;&nbsp;\u0e01\u0e32\u0e23\u0e01\u0e33\u0e40\u0e19\u0e34\u0e14 PWM \u0e41\u0e1a\u0e1a\u0e19\u0e35\u0e49\u0e21\u0e35\u0e1b\u0e23\u0e30\u0e42\u0e22\u0e0a\u0e19\u0e4c\u0e2b\u0e25\u0e32\u0e22\u0e07\u0e32\u0e19\u0e41\u0e25\u0e49\u0e27\u0e41\u0e15\u0e48\u0e07\u0e32\u0e19\u0e17\u0e35\u0e48\u0e40\u0e23\u0e32\u0e15\u0e49\u0e2d\u0e07\u0e01\u0e32\u0e23\u0e08\u0e30\u0e17\u0e33\u0e04\u0e23\u0e31\u0e1a&nbsp;&nbsp;\u0e42\u0e14\u0e22\u0e2b\u0e25\u0e31\u0e01\u0e40\u0e25\u0e22\u0e01\u0e47\u0e04\u0e37\u0e2d\u0e01\u0e32\u0e23\u0e04\u0e27\u0e1a\u0e04\u0e38\u0e21\u0e04\u0e27\u0e32\u0e21\u0e40\u0e23\u0e47\u0e27\u0e02\u0e2d\u0e07\u0e21\u0e2d\u0e40\u0e15\u0e2d\u0e23\u0e4c\u0e41\u0e1a\u0e1a BLDC \u0e41\u0e25\u0e30\u0e22\u0e31\u0e07\u0e2a\u0e32\u0e21\u0e32\u0e23\u0e16\u0e43\u0e0a\u0e49\u0e43\u0e19\u0e01\u0e32\u0e23\u0e04\u0e27\u0e1a\u0e04\u0e38\u0e21\u0e04\u0e27\u0e32\u0e21\u0e2a\u0e27\u0e48\u0e32\u0e07\u0e02\u0e2d\u0e07\u0e2b\u0e25\u0e2d\u0e14\u0e44\u0e1f\u0e02\u0e19\u0e32\u0e14\u0e40\u0e25\u0e47\u0e01\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e40\u0e0a\u0e48\u0e19 LED \u0e44\u0e14\u0e49\u0e14\u0e49\u0e27\u0e22\u0e01\u0e32\u0e23\u0e1b\u0e49\u0e2d\u0e19 PWM \u0e40\u0e02\u0e49\u0e32\u0e44\u0e1b\u0e43\u0e19 LED \u0e14\u0e49\u0e27\u0e22 duty cycle \u0e17\u0e35\u0e48\u0e40\u0e1b\u0e25\u0e35\u0e48\u0e22\u0e19\u0e41\u0e1b\u0e25\u0e07\u0e23\u0e30\u0e2b\u0e27\u0e48\u0e32\u0e07\u0e0a\u0e48\u0e27\u0e07 10 &#8211; 90% \u0e0b\u0e36\u0e48\u0e07\u0e08\u0e30\u0e17\u0e33\u0e43\u0e2b\u0e49 LED \u0e2a\u0e27\u0e48\u0e32\u0e07\u0e19\u0e49\u0e2d\u0e22\u0e16\u0e36\u0e07\u0e21\u0e32\u0e01 \u0e01\u0e48\u0e2d\u0e19\u0e2d\u0e37\u0e48\u0e19\u0e21\u0e32\u0e14\u0e39\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e02\u0e2d\u0e07\u0e23\u0e39\u0e1b\u0e04\u0e25\u0e37\u0e48\u0e19 PWM \u0e01\u0e48\u0e2d\u0e19\u0e27\u0e48\u0e32\u0e25\u0e31\u0e01\u0e29\u0e13\u0e30\u0e02\u0e2d\u0e07 duty cycle \u0e27\u0e48\u0e32\u0e21\u0e31\u0e19\u0e08\u0e30\u0e40\u0e1b\u0e47\u0e19\u0e2d\u0e22\u0e48\u0e32\u0e07\u0e44\u0e23&nbsp;&nbsp;\u0e08\u0e32\u0e01\u0e20\u0e32\u0e1e\u0e19\u0e35\u0e49\u0e08\u0e30\u0e40\u0e2b\u0e47\u0e19\u0e27\u0e48\u0e32\u0e23\u0e39\u0e1b\u0e04\u0e25\u0e37\u0e48\u0e19\u0e2a\u0e35\u0e48\u0e40\u0e2b\u0e25\u0e35\u0e48\u0e22\u0e21\u0e08\u0e30\u0e21\u0e35\u0e04\u0e27\u0e32\u0e21\u0e01\u0e27\u0e49\u0e32\u0e07\u0e0a\u0e48\u0e27\u0e07 ON \u0e41\u0e25\u0e30 OFF \u0e43\u0e19 1 \u0e0a\u0e48\u0e27\u0e07\u0e04\u0e25\u0e37\u0e48\u0e19&nbsp;&nbsp;\u0e16\u0e49\u0e32\u0e0a\u0e48\u0e27\u0e07 ON \u0e21\u0e35\u0e04\u0e48\u0e32\u0e19\u0e49\u0e2d\u0e22\u0e01\u0e47\u0e2b\u0e21\u0e32\u0e22\u0e04\u0e27\u0e32\u0e21\u0e27\u0e48\u0e32 % \u0e02\u0e2d\u0e07 duty cycle \u0e21\u0e35\u0e04\u0e48\u0e32\u0e15\u0e48\u0e33&nbsp;&nbsp;\u0e41\u0e25\u0e30\u0e2b\u0e32\u0e01\u0e0a\u0e48\u0e27\u0e07 &hellip; <a href=\"https:\/\/navy007.com\/WP\/archives\/353\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;ESP32 (EP.5) ESP32 \u0e01\u0e31\u0e1a\u0e07\u0e32\u0e19 PWM&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[260,3],"tags":[269],"class_list":["post-353","post","type-post","status-publish","format-standard","hentry","category-arduino-esp32","category-3","tag-pwm"],"_links":{"self":[{"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/posts\/353","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/comments?post=353"}],"version-history":[{"count":1,"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/posts\/353\/revisions"}],"predecessor-version":[{"id":354,"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/posts\/353\/revisions\/354"}],"wp:attachment":[{"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/media?parent=353"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/categories?post=353"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/navy007.com\/WP\/wp-json\/wp\/v2\/tags?post=353"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}