Sending decimal to pins as separate bits

Hi,

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.

kindest regards to all.

You could take a look at bitRead if your bit manipulation skills are shaky.

Many thanks for your suggestions guys.

Very much appreciated.

try bitRead()

something like this snippet:

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()
{
  
}

I think you want to leave the [ ] empty if you have data defined in the { }.

CrossRoads:
I think you want to leave the [ ] empty if you have data defined in the { }.

Nope.