I am a Arduino newbie - What I would like to do is derive a voltage, say 0-5v that correlates to what is displayed on the LoL Shield. I guess a DAC which converts 0-1023 to 0-5v. The big question is that I would like the the voltage to correlate with the display, so say if LED's are primarily lit on one side of the LoL shield the voltage will be lower and the voltage would be higher if they were primarily lit on the opposite field. If LEDs were randomly lit through the field there would be some correlation in the voltage output to the total LEDs lit. You can kind of think of it like the LEDs are all connected to a large resistor ladder DAC. However, I suspect some digital output already exists in the code that maybe I can program as a analog output or even a digital output and use a chip for DAC? Any suggestions would be great. Thanks!
Did you want to treat the 126 pixels of the LoL Shield as bits in a 126-bit number and map that down to 10 bits (0-1023)?
If not, what mapping did you want between the roughly 8.5*10^37 patterns and the 1024 possible analog output levels?
Yes, I think that method would accomplish what I'm after.
So if you want to compress 126 bits down into 10… I’d group the LEDs into sets of 13 (or maybe 14 since there are 9 rows of 14) and if there are more then 7 LEDs on, count that as a 1.
What code are you using to set the LEDs? The loop that sets the LEDs is likely a good place to calculate how many LEDs are on in a row or column.
When you say "if there are more then 7 LEDs on, count that as a 1" I'm not sure I understand what that means exactly. Dees that mean it would take 7 leds lit up to even register as a 1 out of 1023 or am I completely off.
The way I was thinking of it is more like an R2R DAC where each pixel has a value. Say the top left LED is the lowest value 0v/0 and the bottom right is the highest value 5v/1023. Any combination of pixels would be all the values added up divided by the number of pixels. So say 5 pixels are lit and voltage values are as follows 1v, 2.2v 3.4v, 3.6v, 4.8v. The output would be 3v.
5v/126=0.0397 voltage increments. So roughly... Pixel 1 - 0v - integer0 (I started at 0 but I should probably start at 0.0397 with 0V being no LEDs lit) pixel 2 - 0.0397v - integer 8 pixel 3 - 0.079v - integer 16 pixel 10 - 0.357v - integer 72 Pixel 50 - 1.945v - integer 392 Pixel 100 - 3.93v - integer 792 Pixel 126 - 4.963v - integer 1000
...or something of this sort. It doesn't have to be precisely this method but like I said. I want some correlation as to which LEDs are lit and what voltage value comes out. The only way I can think to do this is so somehow assign each LED/Pixel an integer, which corresponds to a voltage between 0-5v. The output is the sum of the LEDs lit divided by the number lit, providing a output value between 0-5v.
I think that even if I can't do the DAC internally, if I could get a digital ouput that is the sum of the LEDs chosen divided by the number, I should be able to convert that to a voltage easily with a DAC chip...
The code I would be using to start is just the LoL Shield Game of Life example, which I can post if needed.
Still hoping to figure this out.
Jimmie Rodgers posted the pinmap for the LOL Shield LEDs here: https://spreadsheets.google.com/pub?key=t_EOF_AD8aM_FXxJNH_k8VA&single=true&gid=2&output=html
If I understand correctly, the LOL Shield is using the 12 digital pins as 0 or 1 and not as serial outputs basically there is a combination of 12 pins firing at any given time, which light the pixels/leds. Basically 12 bits if I understand correctly. Now I am thinking I could accomplish what I am after by using a 12 bit parallel input DAC like in the attachment to this post.
Does this make sense? Is there a better way to do this