I have the 8-bit data bus of a chip connected to Arduino Uno pins 2 through 9. I need to send out decimal 27 (binary 00011011) to these pins so pin 2 receives the MSB (0) and pin 9 received the LSB (1). I then take another pin low so that the external chip knows that the data is on its bus for reading.
Not sure how to do this. Any pointers would be much appreciated please.
int value = 27;
byte outputPin[8] = {2,3,4,5,6,7,8,9}; // for example
void setup()
{
for (byte i = 0; i < 8; i++)
{
digitalWrite(outputPin[i], bitRead(value, i));
}
}
void loop()
{
}