How do i control the LED brightness using PWM? I am new to tiva and i am wondering how do i have to use timers and interrupts to control the LED brightness :) I am using the TM4C123G by the way.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
How do i control the LED brightness using PWM? I am new to tiva and i am wondering how do i have to use timers and interrupts to control the LED brightness :) I am using the TM4C123G by the way.
Hello Nichol,
The TM4C123G has a PWM module which can be used to generate a PWM output. What is the Frequency that you are looking for the PWM output, what is the max brightness ON time and min brightness ON time that you are looking for?
Regards
Amit
Err i am using a PWM frequency of 50Hz since the that is the minimum frequency such that the LED would not be seen as blinking when adjusting the brightness. The maximum brightness ON time and minimum brightness ON time can be forever until i disconnect the the power supply. If possible, may i know how can i adjust the brightness of the LED (one color only) by using the SW1 and SW2 buttons?
Hello Nichol,
1. For controlling the PWM as I mentioned there is the PWM module. There is an example code in the TIVAWare C:\ti\TivaWare_C_Series-2.1.0.12573\examples\peripherals\pwm\reload_interrupt.c that you can use as reference
2. You can use SW1 (increase) and SW2(decrease), by setting up the GPIO's connected to them for Falling Edge Interrupt.When the Interrupt is asserted you can load the new PWM On Time value based on whether SW1 or SW2 is pressed (by adding or subtracting the required time).
Regards
Amit
Okay ! I shall look into it. Thanks Amit! I appreciate your help and fast response :)