Hi there. I'm a first time programmer and I wanted to ask if it is possible to write a program that allows you to switch ON an LED using a pushbutton and be able control the brightness of that LED using a potentiometer.
Actually no program or Arduino is needed to do this. Just connect a power supply, pushbutton, potentiometer, and current limiting resistor in series to the LED.
LloydBlessing:
Hi there. I'm a first time programmer and I wanted to ask if it is possible to write a program that allows you to switch ON an LED using a pushbutton and be able control the brightness of that LED using a potentiometer.
Any of the PWM pins can be used for analogWrite() and digitalWrite(). Any of the analog pins can be used for analogRead() and digitalWrite(). None of the pins can be used for all 3 functions.
And if you are asking if you can connect your LED, your switch and your potentiometer (or any 2 of them) to the same I/O pin then the answer is NO.
...R
Oh I see. Thanks R. I'll try doing that.