title: Shift Register 74HC595 Output Current
body: <p>I'm testing/debugging a C++ program that uses the 74HC595 shift register (Arduino Teensy3.2 @ 3.3V).</p>
  
  <p>I want to connect the 8 outputs of the SR back to 8 input pins on the Arduino board.</p>
  
  <p><strong>My question is:</strong> would I need resistors between the output of the shift register and the Arduino input? How to know the current flowing from the SR output?</p>
  
  <p>I did have a look at the datasheet but that just confused me more:
  <a href="https://www.taydaelectronics.com/datasheets/A-251.pdf" rel="nofollow noreferrer">https://www.taydaelectronics.com/datasheets/A-251.pdf</a></p>
  
  <p>CODE TO SET THE REGISTERS:</p>
  
  <pre><code>void ShiftRegisterOut(uint8_t bitOrder, uint8_t val)
  {
    for (uint8_t i = 0; i &lt; 8; i++)
    {
      if (bitOrder == LSBFIRST)
          digitalWrite(pinData, !!(val &amp; (1 &lt;&lt; i)));
      else    
          digitalWrite(pinData, !!(val &amp; (1 &lt;&lt; (7 - i))));
      digitalWrite(pinClock, HIGH);
      digitalWrite(pinClock, LOW);
    }
  }
  </code></pre>