I am new to the Forum and did some searching around looking for an example, but could not find one. I am trying to display the contents of an EVPROM and wanted to achieve this by using the Arduino Uno as a binary counter for the 10 bits. Is there an easy way to count through ten bits on the output pins?
The easy part is... all of the data in the computer's memory is already in binary. So,you don thave to "count in binary"... You just have to count! (You don't necessarily need an array, unless it makes it easier for you to understand what you are doing.)
To make things a little easier, let's assume a 4-bit number... In binary, the least significant bit (on the right) is bit-zero, and the most significant bit (on the left) the right is bit-3 when we have a 4-bit number.
If we store the number "3" as a variable, that's 0011 in binary.
We can use the [u]bitRead()[/u] function to read one bit at a time.
After reading each bit, one at a time, we can write each bit to an I/O pin. If we write the above value "3" as bit-0 to pin-0 and bit 3 to pin 3, etc. our output-pins will look like this:
Pin 0 = High
Pin 1 = High
Pin 2 = Low
Pin 3 = Low
Then if we increment a counter, changing the variable from "3" to "4" (0100 in binary) and write that new data to the output pins, we get:
Pin 0 = Low
Pin 1 = Low
Pin 2 = High
Pin 3 = Low