# How can I make my homemade 3x3 matrix show numbers like 2, 3, and 5 like the are shown on a dice?

I made a 3x3 matrix with my arduino, with transistors on the collums and the rows hooked up with wire, going to the output. I have a arduino, with 6 PWN outputs, luckily, and 14 total digital pins, and also 6 analog pins. So I need help having a 2 show up on my display, because it looks like a 4. and this is shown like it is on a standard dice. Soo... what am I doing wrong? I am just turning the collums and rows on and off to show lights and stuff. So ... help!

geniusbomberman7 years ago
you probably wouldn't need them PWM outputs for this, just 6 digital outs
just bring the column low and row high(or vice versa) for each led you want on, and cycle through them quickly.  In a small matrix, this would only save 3 pins, but in a large one it would save dozens.
wildanddangerous7 years ago
thinkdunson7 years ago
to display the lights continuously, you would need one output line for each light, plus a common ground/source. this way, with dedicated outputs, you can just tell them to be on and they'll stay that way while it continues with the rest of your program. another way to do it would only use six outputs: turn on a light, pause a few milliseconds, turn it off and light the next one, wait, turn it off and light the next one, etc. persistence of vision will make the lights appear constant. the problem is that you can't leave them on this way and let your program continue, so you would only use this method if you have a dedicated microcontroller specifically for the lights, or if you don't need to do anything else while the lights are being controlled.
frollard7 years ago
to do a matrix you count rows and columns in loops.
pseudocode:

you need 6 pins (ideally)

for y = 4 to 6 'rows counter
enable row y
if light(1,y) should be on, enable 1
if light(2,y) should be on, enable 2
if light(3,y) should be on, enable 3
next y

this doesn't account for any necessary delays, or turning outputs back off.