Back to Parent

Getting Inputs

Exercise 1

Combine a switch and potentiometer. The switch should turn on and off the light while the potentiometer will fade up and down the light (but only when it’s on).

I wired a button to the circuit created in the tutorial “using a potentiometer”. I started with reusing the code in that tutorial and defined a new pin that I would place a button on. I reorganized the code related to analog readings/values to the if (buttonState == LOW) condition. Following the 3 step-by-step tutorials is really helpful and it makes the practice exercise less daunting!


Content Rating

Is this a good/useful/informative piece of content to include in the project? Have your say!

0