simple pwm question

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

simple pwm question

#1 Post by GravityRZ » 02 Mar 2021, 18:14

when switching leds you can use either gpio or pwm

gpio,14,0 (led off)
gpio 14,1 (led on)

pwm,14,0 (led off)
pwm,14,500(led on at certain level)

so i should either use gpio or PWM but not both for the same gpio pin (unless i reset pwm with pwm,14,0 first)

what happens if you use them together
eg
pwm,14,500
gpio,14,0
gpio,14,1


regardless if this will work can this damage the esp chip?

TD-er
Core team member
Posts: 8644
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: simple pwm question

#2 Post by TD-er » 02 Mar 2021, 20:46

It will stop sending PWM and switch to GPIO mode.
So giving a GPIO command is also usable to turn off a PWM signal.

Just keep in mind that sending a high DC signal to something like a speaker, may not be a good idea, so always keep that in mind when you switch modes like this.

GravityRZ
Normal user
Posts: 206
Joined: 23 Dec 2019, 21:24

Re: simple pwm question

#3 Post by GravityRZ » 03 Mar 2021, 20:25

thanks

i am going it only to dim leds so it should be safe

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 32 guests