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.
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.
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?
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?
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?