Joystick-RGB light idea, possible?

OK, So my older brother recently got angry with his trusty XBOX controller, and one of the analog sticks had failed within it. This struck an idea and I was pretty sure all an analog stick was, was two variable resistors. (which they are!!!) So with only one working I decided to desolder it out of the board, this was surprisingly really easy :L and then wacked it on a piece of stripboard to test what values they give off etc. It turns out the spectrum you recieve back is 1-100% it is really precise and you can get 0 back or 1023 and when it idles is resets itself and goes back to the middle!

So as my pan and tilt mould came throught the post today I had a little go and it works great, controller a camera with an analog stick is really cool. But I thought of controller the colour of an LED with this analog stick. having a 2D plane means I can set each pixle 1024*1024 to a seperate colour ;D.

So my question is, will mapping this out on the plane be possible to send the colour over to an LED?
Thank you very much, and here is a picture:

:slight_smile: Thank you all for your help Trevor Boultwood!

Mapping a 2-d plane into anything, including LED color, is very easy. I have done this in the past for joysticks. First, recognize that you need to create a finite grid(1x1, 5x5, 100x100, 4x10) of whatever size you choose. Each grid zone will be a different value which you can translate to color. The grid value is simply the x and y coordinates mapped from 0-1024 to 0-whatever grid size you choose.

To easily translate this into code simply multiply the x value by 10 or 100 or 1000 to represent a number higher than any value of y. Then add the new x value to the y value resulting in an integer with the "value" encoded. For example:

3x3 grid is (0,0) (0,1) (0,2) (1,0) (1,1) (1,2)...etc x-value*10+y-yalue for each would be 0 1 2 10 11 12...etc

So, you read the x and y values, let color = (x-value*10)+y-value, then act on the color through a switch statement.

Then just use a switch statement to convert the integer into a RGB value.

Thank you very much for the reply, but you have to excuse me, All i really know how to do is literally do simple tasks with the arduino. :S I don't have much proggramming skill. Out of interest, is there a book that could teach you basics up to advance for the arduino as I really struggle on the programming side. Thank you very much, Trevor.