Controlling the Brightness of an LED (Using PWM in PIC)

Discussion in 'Embedded Systems and Microcontrollers' started by kaybie14, Feb 1, 2010.

  1. kaybie14

    Thread Starter New Member

    Nov 9, 2009
    hello guys.. i have a project intending to control the brightness of an LED light using PWM in PIC microncontroller.. i also used LDR as a sensor. I find some difficulty regarding the program of PWM as well as the program for the sensor that there is no need for ADC.. can you help me regarding this matter that can make me understand the concept of the program? or can you provide me a sample program for this.. thank you guys..
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    Do you want the LED brightness adjusted with the LDR?

    If so, you should use the ADC to read the LDR and determine the PWM for the LED.

    There sure are a lot of 3 letter abr.

    AAC Fanatic!

    May 26, 2009
    What language will your be using? They have a BASIC language compiler that will transfer your code to the C language. All you would need to use is the PWM command for BASIC:

    Code ( (Unknown Language)):
    2. PWM 0, 150, 1000
    Where 0 = Pin number 0
    150 = Duty cycle (0-225)
    and 1000 = duration in mS.