I am making a game of X and O’s and ran out of pins on the Arduino. After searching on the internet I found out about connecting it in a grid connecting all the anodes in columns and the different colours in rows but I don't know how to connect the anodes so it only turns on only one of the LEDs rather than the other 2 in the grid if they are all connected to ground. The wires I am unsure to connect are the orange ones in the diagram below (bottom left corner). Note the Red on the RGBs are not used so don't need to be connected

enter image description here


Firstly, you have made the classic rookie mistake with your circuit regarding your LED current limiting resistors. You have one per LED group instead of one per LED within a group. The arrangement you have at the moment means that at best some LEDs will be dim or not light at all, and at worst will result in LEDs burning out.

There should be a resistor in every red, green and blue wire in your diagram.

As for what to do with the three orange wires (once you have re-arranged the resistors) they connect to three spare IO pins on the Arduino - you then turn each column on or off as you need - only one column is on at a time. If you need more than 20mA for a column (which is highly likely with up to 9 LEDs on at a time) then those lines should be connected to either +5V or GND (depending on if you are common anode or common cathode) via transistors and the transistors should be switched by the IO pins.

| improve this answer | |
  • So you just connect it to the 3 analogue pins and how would you code it if it would normally go to the ground – bob1252 Nov 8 '15 at 14:26
  • If they are common cathode (normally connect to ground) then set a pin HIGH to turn a column off, or LOW to turn it on. Cycle through them nice and fast. – Majenko Nov 8 '15 at 14:49
  • Thanks for the help but I ended up abandoning this project in the end – bob1252 Sep 16 '16 at 20:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.