shifting out data one bit at a time isn't working

I'm trying to roll my own onewire functions and I am getting hung up pretty early.

This is the snippet that is having problems.

void loop()
{
  //Serial.println(reset());
  send_byte(10110110);
  delay(1000);
}

void send_byte(byte v)
{
  byte mask;
  for(mask = 1; mask; mask<<=1)
  {
    //send_bit(mask & v);
    if(mask & v)
    {
    Serial.print(1);
    }
    else
    {
      Serial.print(0);
    }
  }
  Serial.println();
  
}

This is what I get as output from the Serial.print:

01111001
0
01111001
0
01111001
0
01111001
0

Why is it not shifting out:

10110110
0
10110110
0
10110110

Why is it not shifting out:

10110110

Because you did not tell it to shift that out. You passed 10110110 to the function, which is:

100110100100010010011110 in binary.

You then shifted out the last byte in that value starting at bit 1, which is exactly what you saw on your Serial Monitor.

lar3ry beat me to it.

General debugging tip - when your code isn't doing what you expect it to do, make sure it has what you expect it to. In this case, adding a Serial.println(v); at the beginning of your send_byte routine would have immediately showed you that it had a different number than you thought it did.

Fantastic! All good to go now. Thanks!