The Potentiometer
In this week’s challenge, we introduce the use of a potentiometer, which is a variable resistor. We will use this to control the rate of the blinking LED.
This week’s Journal Entry
Material needed
Code for inital challenge
Code and Circuit Play.
1. See what happens if you use two digital pins rather than one digital and one analog pin. Changing the wires to 2 digital pins removed the control of the light using the potentiometer. The light remained a constant blink.
2. See what happens if you use two analog pins rather than one digital and one analog pin. Changing it to two analog pins made the light go dark.
3. What happens if you replace analogWrite with digitalWrite and vice versa? When you replace digitalWrite with analogWrite the LED is no longer lit
Extension Challenge
1. Can you control 2 lights with the same brightness or same blink rate? Yes, I added the red LED to d20,g21 and they blink at the same rate
2. Can you control 2 lights with one potentiometer but have them controlled so that as one light gets dim, the other gets bright or one blinks fast while the other blinks slow? Yes, I was able to do that. I did try to name Pin 12 as a variable but couldn’t get the code to work. That will be something to look into.
Challenge Code
Two LEDs going blinking at opposite rates