From the course: Learning Arduino: Pulse Width Modulation
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Challenge: Matching PWM and non-PWM LED brightness - Arduino Tutorial
From the course: Learning Arduino: Pulse Width Modulation
Challenge: Matching PWM and non-PWM LED brightness
- Okay folks, it's time for our first challenge. In this challenge, I want you to fake PWM output on a non-PWM pin to match the brightness of two LEDs. In the exercise files, open 01_04 Challenge handout. I have listed eight PWM values. There's also a location to write in delay values for the non-PWM LED labeled A and B. For each PWM value, calculate the duty cycle. Then for each value, write down the number you think best fits A and B from the sample code block. For values 1-4, calculate and document the values. These values will make the LED too dim for you to see so don't worry about uploading the code to test. For the values calculated for 5-8 take the time to upload the code to test. You can find sample code for the project in the sketch 01_04 Challenge. You will need an LED with a resistor in series on pins 7 and 9. You goal is to match the pulse width modulated output of pin 9 on pin 7, so that the LEDs' brightness match. Keep in mind that the delay values need to be very low…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.