I m transplanting new server hardware into an old apple server case. I would like to repurpose a small pcb that has a number of blue smd leds in order to liven up the project aesthetically. These LEDs use a common anode, if I am saying that correctly. Meaning that if I apply 3.3v to a certain point in this pcb, then I just touch a ground to any led cathode, and it will light up.
I would like to create a small light show with those, nothing fancy. Some permanently on and some blinking.
If I were to solder a wire to each led cathode I would like to control, is there any way I could create the blink effect through the digital pins? I mean, I do understand that if I pull the pin low, the led will light up, but how do I turn it off?
if I apply 3.3v to a certain point in this pcb, then I just touch a ground to any led cathode, and it will light up
You should always use a series resistor. You risk damaging the LEDs if you don't.
You may be able to switch the LEDs of by making the Arduino pin high or changing it to an input. If you use high, remember that most Arduino are 5V, so choose an appropriate series resistor.
The PCB shown is complex and unknown. It's possible that if you connect 5V or 3.3V to the common anodes, current will follow to other parts of the PCB and overload the Arduino output.
Thank you very much Paul for your reply. I applied 3.3v to a pin on that connector on the top right of that pcb where I suppose it goes through a resistor before it reaches the LED's anode.
But, you are absolutely right that I have absolutely no clue of how current travels through that PCB and how much load I m putting on the arduino pin. I guess I ll just take my chances.
For now I ll try both your recommendations with the "change to input" being the one that seems to be the simplest for setting up. I have rea though that using pinmode in the loop section is not recommended.
using pinmode in the loop section is not recommended.
Nonsense. It's absolutely fine. You probably saw some newby getting told off for it because they had no clue what or why they were doing it. You have a good reason. You don't want to accidentally source current to an unknown circuit.
int ledPin = 13;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
digitalWrite(ledPin, LOW); // turn the LED on by pulling it to ground
delay(1000); // wait for a second
pinMode(ledPin, INPUT); // Switch the pin's mode to Input, so it basically does nothing and the led turns off
delay(1000); //wait for a second
pinMode(ledPin, OUTPUT); // Switch back the pin's mode to output in order to pull it to ground and keep the loop running
}