anyone have an idea how i can use 2 pot to controll the brightness of 1 led?
i was hopeing to avoid a switch, but maybe its the only way? anyone have a idea for a solution?
i*m working on a project where i need to controll 1 led from 2 different controll panels.
Are both pots attached to the same analog input? That would give some unexpected results, not what you wanted, I think. If one pot is fully clockwise and the other is fully anticlockwise, there will be a dangerous short circuit.
You must always have a current limiting resistor in series with your led, otherwise the Arduino pin and also the led could be damaged.
Your led is shown connected to A1 pin. Most analog input pins can be used as output pins, but on Nano they do not have PWM capability, which is required to dim a led.
Have you thought in detail about how your 2 pots would control the led?
For example if pot A is set at 50% position and pot B is set at 75% position. What % of brightness should the led be? What if pot A is then reduced to 25%? What happens with the led then?
Simple.
Connect one pot to A0, the other to A1. Connect the LED with resistor to a PWM pin.
When you want to change the LED brightness using either pot, first set the pot to zero then move it to the level you want. In your code you monitor the pot values and find out which one went to zero then to a new level, then use that pot value to set the brightness.
One possible way is to light the led according to whichever pot as adjusted last. This is not quite as easy as it sounds, because analog inputs always have some noise which will change the value from one reading to the next, even if the pot has not been adjusted. So some threshold must be used to ignore small changes that are not due the adjustment of a pot.
If you are able to remove potentiometers (ten-turn, ever-changing values) and use rotary encoders (continuous sweep pulse generators), your code will count pulses from either input and not varying resistances.