Duty cycle control for motor/LED
📖 Scenario: You are working on a simple embedded system that controls the brightness of an LED or the speed of a motor using PWM (Pulse Width Modulation). The duty cycle determines how long the signal stays ON in one cycle, affecting brightness or speed.In this project, you will write code to set up the duty cycle and then calculate the ON time based on a fixed period.
🎯 Goal: Build a program that defines a duty cycle percentage, calculates the ON time for a PWM signal with a fixed period, and prints the ON time value.
📋 What You'll Learn
Create a variable to hold the PWM period in microseconds
Create a variable to hold the duty cycle percentage
Calculate the ON time based on the duty cycle and period
Print the ON time value
💡 Why This Matters
🌍 Real World
PWM signals are used in many devices to control motor speed, LED brightness, and other electronics by adjusting the duty cycle.
💼 Career
Understanding duty cycle control is important for embedded systems engineers and anyone working with hardware control and microcontrollers.
Progress0 / 4 steps