LED multiplexing code

I am so screwed up with the arduino code while TRYING to code my multiplexed LED's (4x8, for good measure). I have been told to flash an led on then off and then to do that to another led immediately in milliseconds to get the illusion that they are both turned on at the same time. Problem is, I suck at coding with arduino and I have no idea of how to flash the LED's on and off. I tried a sample that I made :

void setup() {
  pinMode (2, OUTPUT);
  pinMode (3, OUTPUT);
  pinMode (4, OUTPUT);
   pinMode (5, OUTPUT);
    pinMode (6, OUTPUT);
     pinMode (7, OUTPUT);
      pinMode (8, OUTPUT);
       pinMode (9, OUTPUT); 
        pinMode (10, OUTPUT);
         pinMode (11, OUTPUT);
          pinMode (12, OUTPUT);
          pinMode (13, OUTPUT);
    
  }
void loop()
{
digitalWrite(12, HIGH);
digitalWrite(4,LOW);
delay(1);
digitalWrite(12, LOW);
digitalWrite(4,HIGH);
delay(1);
digitalWrite(10, HIGH);
digitalWrite(7,LOW);
delay(1);
digitalWrite(10, LOW);
digitalWrite(7,HIGH);
delay(1);
digitalWrite(13,LOW);
digitalWrite(11,LOW);
digitalWrite(9,LOW);
digitalWrite(8,LOW);
digitalWrite(6,LOW);
digitalWrite(5,LOW);
digitalWrite(3,LOW);
digitalWrite(2,LOW);


}

but it turns on all the LED's in the columns that I want specific LED's to turn on.
Any ideas? Thanks.

Any ideas?

Same idea that occurred in your other posts. We need to see a schematic. We have no idea how you have connected the LEDs and resistors. Which rows are connected to which pins? Which columns are connected to which pins?

You can test that the connections are correct for turning on an individual LED by putting two digitalWrite() calls in setup(), and leaving loop() empty.

If one LED lights up, and the rest don't, that LED is wired correctly. If multiple LEDs light up, that row or that column is not wired correctly.

I am just wondering for the code part of it. I just want an example to blink an led on then off and then blink another led on while that is off in the span of a few milliseconds to make the illusion that multiple LED's are turned on at the same time. I can change it to match the specific details of my matrix.

In your initial post, you said that you couldn't get just one LED to light up. Until you can do that, writing more complex code is a waste of time and effort.

I can get only one lit up at a time, but I need help making code to light up more than one led as an illusion (let's say blink one led, turn it off then turn on another led in around 10ms, and keep this in a loop, to create the illusion that they are both on at the same time). Please! I really need help!

See this:-
http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix

Psst, Mike - you don't have to repeat the title - you're allowed to edit it when you reply

Yes but it still shows up in the list with the original title unless the first post is changed.

Better now? :stuck_out_tongue_closed_eyes:

:slight_smile: