Let’s say you have a lamp. You want to change its brightness of it. You can use a set resistor to do this, but this will convert some of the electricity into heat. Instead, how to turn on and off the lamp at regular intervals. If we turn the lamp on and off too quickly, it will come to us as if the lamp never went out. Because the off time is shorter than the extinguishing time. If we increase the switch-off time slightly, we will see as the lamp brightness is decreasing. This mechanism is called PWM (Pulse Width Modulation).