Author Options:

Arduino Multiplexing Code Issue Answered

I'm trying to select a pattern for 12 multiplexed leds (2x6) using the input from a pot. The different patterns are stored in arrays. To complicate matters two of the states include a blinking led, the first, redShift attempts to blink a single led, 1, using a for loop to step through an array. The other holds on leds 2-11 and flashes 12 using the same method. The input from the pot is diveded into 12 sections and a switch case is supposed to select the proper arrays to read from.

Here is the code:
I'm having two issues. First, the switch case doesn't appear to be working. I've monitored the pot input but there is no response from the LEDs. The second is with the for loops that are suppose to run the blinking. I know the loop on the inside will hold a pattern but in test code, without the pot, but adding the outside loop to step through the pattern array breaks it and the LEDs don't respond. Is the for loop running to fast to respond but not fast enough for POV? do I need a third loop that repeats each position but wouldn't that break the POV for the other LEDs? Or is there some stupid error I'm missing?


Throw some print statements in your code to track flow of the program. See if your program even goes into the switch cases.

The rows are leds 1-6 in row one and 7-12 in row two.