Sending an analog value through digital pins

So, I need my arduino to read and analog value (0 to 1023) and then send it through 4 digital pins. My idea was to do something like this:

analogvalue = 850
analogvalue/64 = 1110

What I need is to convert and INT into a BIN and then send that BIN through the digital pins. Any thoughts?

Why?
Are the 4 pins to control something else?

Its for a college project. I need the arduino to read an analog value from a sensor, then send it as a digital value to another chip.

I need the arduino to read an analog value from a sensor, then send it as a digital value to another chip.

That's why we have I2C.

What sensor? What other chip?

What I need is to convert and INT into a BIN and then send that BIN through the digital pins.

A lot more detail is required or the whole thing is just guesswork.

What I need is to convert and INT into a BIN

An "int" already is in binary; no conversion necessary

Temperature, light and moisture sensors. All analogs from 0 to 1023 (minus temp sensor). And I need that divided by 64, so it can fit in a 4 bit binary (16 values). Then, I need to send those 4 bits through digitalWRITE to an Altera CPLD that only reads digital.

Are you aware of the shiftOut function?

Making it 4 bit reduces the resolution very much... But can't you just use I2C, Serial, shiftOut or anything else for it? Sounds a bit like a X-Y problem.

Or iirc, that's what one can do with a shift register like a 74hc595?

(Don't quote me, but I think that's what they do.....)

edit... and that's on the shiftOut man page that AWOL linked

So, I need my arduino to read and analog value (0 to 1023) and then send it through 4 digital pins.

So you want to use four digital pins on the arduino to connect to four input pins on your device, with the the arduino pins either being high or low to represent a four bit value?

That's how I read it too. If so

const byte outPins[] = {10, 11, 12, 13};

void setup()
{
  for (int pin = 0; pin < 4; pin++)
  {
    pinMode(outPins[pin], OUTPUT);
  }

  for (int x = 0; x < 16; x++)
  {
    for (int bit = 0; bit < 4; bit++)
    {
      digitalWrite(outPins[bit], bitRead(x, bit));
    }
    delay(1000);
  }
}

void loop() {}

@UKHeliBob - that's going to be tough to decode without a clock

josysclei:
Temperature, light and moisture sensors. All analogs from 0 to 1023 (minus temp sensor). And I need that divided by 64, so it can fit in a 4 bit binary (16 values). Then, I need to send those 4 bits through digitalWRITE to an Altera CPLD that only reads digital.

What is the software/hardware protocol that the Altera uses to read inputs on those particular pins? Can you change it, or is that in someone else's domain?

AWOL:
@UKHeliBob - that's going to be tough to decode without a clock

Yes, but as we don't actually know what the OP really wants .......

First of all, I'm pretty new in arduino, so I2C is a bit too much for me. The shiftOut idea is a nice one, going to test it. To try and make myself even more clear, here is a picture of what I'm using:

Normally we send inputs with those switches in the bottom of the board, sending 0s and 1s by turning them on and off. What I need is the Arduino to send those 0s and 1s, based on the value from a sensor the Arduino is reading. Another issue, the board is 3.3V and Arduino is 5V, using a resistor will do the trick?

Following up on AWOLs comment, how will you know when a valid set of values is present ?