Read potentiometer value and present as 8 bit binary number on LED's

Hello,

I am trying to start with Arduino programing, and i have a little program i would like to make.

I would like to connect a potentiometer to A0, and read a voltage between 0 - 5 volt, divide the voltage being read, by 255, and then read out the value as a binary code on 8 LED's, on the output port of the arduino.

I have already the hardware running (a ULN2803 with current limiting resistors and LES's), connected to the 8 bit outputs on the arudino, and the potentiometer connected to the A0 input.

I just cannot figure out how to convert the pot meter value between 0 to 255, into a binary number, and send it to the 8 bit out ports, and see the binary representation, on the LED's of the pot meter value changing, when i turn the pot meter up and down.
Are there already a ready program made (i have seen the Bargraph program bit i do not want bargraph, i want binary)

Thank you very much

I just cannot figure out how to convert the pot meter value between 0 to 255, into a binary number

If I told you that the number already is a binary number, does that simplify things?

Hello AWOL,

Thank you for the answer.
Hmm, sorry for my lack of knowlege, but how do i write the variable, that contains the integer value from the pot meter reading, out to the 8 bit port as 8 bit binary number?

I know this is really basic....sorry..:slight_smile:

Well, you could write it out in one using direct port manipulation (useful Google search term there), assuming you've got a contiguous 8 bit port available, or you could use a for loop and bitRead and digitalWrite (more useful research terms)