# A/D converter with 0 to 1023 binary output

Hi, well, the title say all. I´m trying to do an A/D converter, but i want that the digital conversion be in the digitals pins 2 to 11 in the binary form

For example the minor value 0 is showed in these array of pins 0000000000

if is the max value (1023) is showed

1111111111

i know that the analog pins read 0 to 5V and the max value is 1023=5V

The case is, I want the analog reading be displayed in binary form in an array of 10-bit in the digital pins

any suggestion??????

PD: sorry for my bad english.... :P

just some pseudo for you:

if analogue value is above 1000000000: minus 1000000000 and turn on pin 11...

if analogue value is above 0100000000: minus 0100000000 and turn on pin 10...

... ect

Or to go backwards of that logic (assuming low bit first on pin 2 and high bit on pin 11)

for (int i=0, i<10, i++)
{
digitalWrite(i+2, analog_value & 1); //bitwise and to 1 so we only take the lowest bit
analog_value = analog_value >> 1; //shift it one to the right to put the next bit in the low bit.
}

mmmm...

well, maybe i did´n explain very well

i know the A/D of the arduino converts 0 to 5V in the range 0-1023, were 1023 is the max value...

or 4.88 mV for each value of convertion (1024x0.00488=5V aprox)

internally in the A/D i have 717.21...or 717....and i want show this value in an array...

internally in the A/D i have 717.21...or 717

You have 717 internally.

It is still not clear what you mean by

i want show this value in an array.

An array of what? Do you mean display? The answers given match the question asked.

and i want show this value in an array…

i want that the digital conversion be in the digital pins 2 to 11 in the binary form

What you wish to do is not hard.

Read the analog pin into a variable, then test each bit value of value and turn on or off the digital pin associated with that bit:

``````int value = analogRead(A0);
for (int i=0; i <= 9; i++)
{