Introduction: APPLYING PWM DUTY CYCLE TO LED USING 2 PUSH BUTTONS
Switch or a push button is one of the basic digital sensors we know. Commonly, it is used as a controller of LEDs for basic ON and OFF. However, on this simple activity, you may be able to control the intensity or brightness level of the LED using two push buttons, one that increments and the other decrements.
Step 1: Materials
- Controller board with PWM pin (I used POP-X2 controller board by INEX)
- GLCD or Graphic Liquid Crystal Display (GLCD is built-in to the controller)
- USB Download Cable
- Computer or Laptop with Arduino software ( I used version 1.7.10)
- 2 pcs. Push Buttons
- 1 pc. Single Color LED
- 2 pcs - 10k ohms resistor (for push button)
- 1 pc - 220 ohms resistor
- solid wires (cut) / jumper wires
Step 2: Connect the Components
Make sure that components are properly connected to the controlled board. Connect pins based from the program below. You may modify the pins being assigned.
Note: GLCD is already built-in on the controller board. (Photo by Sparkfun - for push buttons and led)
Step 3: Upload the Program
The program is derived from Debounce. I just added some codes in displaying the intensity level of LED. If you are using any Arduino boards, you may just use any LCD components. Of not, you may just use the serial monitor to display the values.
Note: the intensity level increments by 10 to show that the brightness level is being adjusted. You may modify the codes based from you needs.