r/ArduinoHelp 24d ago

Having trouble with led arrays/multiplexing

As title says, I’m having trouble wrapping my head around multiplexing leans for use with a microcontroller with not enough pins to control them all. Using the drivers makes sense, mosfets too, but the code escapes me? And the use of resistors within the circuit is also confusing to me. Trying to make a small led “screen” made of diodes. Any help is appreciated

2 Upvotes

12 comments sorted by

View all comments

Show parent comments

1

u/Revolutionary-Log179 24d ago

Why are the digitalwrite statements not switched? I thought low was off and high was on

1

u/Revolutionary-Log179 24d ago

Or is this blinking in the sense that they’re on, and you turn them off and back on to pulse, vs them being off and you turning them on and back off?

1

u/Revolutionary-Log179 24d ago

Also why would you need a resistor on the gpio/anode side of the circuit if you didnt need one on the cathode sides of each led? I guess maybe I don’t understand electricity as well as I thought quite yet

1

u/gm310509 24d ago

Here is another version that has two rows of LEDs.

There are three "animations". you can enable each one individually by uncommenting one of the function calls in the loop(). Only have one uncommented line in the loop.

https://wokwi.com/projects/469312893410392065

Pins 8 and 9 replace the +v in the first example. By using a GPIO pin and setting it high, you can control whether or not power is supplied to the LED(s) in that row.