The following materials were used to carry out this experiment:
The implemented circuit was as follows:
The following code was used to generate a PWM signal with a frequency of 1 kHz and a 50% duty cycle:
const int pwmPin = 25;
void setup(){
ledcAttach(pwmPin, 1000, 8);
ledcWrite(pwmPin,128);
}
void loop(){
}
This experiment made it possible to understand the operation of PWM signals and their importance in controlling electronic devices. Additionally, it was observed how a microcontroller can generate modulated digital signals to control the power delivered to a device. This technique is widely used in motor control, LED brightness regulation, and electronic control systems.