title: How to concatenate incoming bytes in arduino c
body: <p>I'm trying to get two bytes in from an SPI sensor and concatenate them (not add them or bitwise OR them). What I have: 11111 and 1111100. What I want: 0001111101111100 (8060 in decimal). </p>
  
  <p>When I Serial.print(firstByte, BIN) my two bytes, Arduino seems to remove the leading 0's (probably because there is some kind of conversion going on and those 0' are do not contribute to the value of the number or something). </p>
  
  <p>That's a problem for me because I would like to concatenate those two bytes including the leading 0's before converting that two-byte binary number into a decimal integer. </p>
  
  <p>Does anyone know a good approach? I'm thinking storing them as a char array, but not sure exactly. In the above example, I could just manually add in a '0' but then it would really only work if those bit values never changed, and that would be a problem.</p>
  
  <p>Here is my code for reference:
  <a href="https://gist.github.com/vwls/852fb5c53112efc77faaecd6bffba25f" rel="nofollow">https://gist.github.com/vwls/852fb5c53112efc77faaecd6bffba25f</a></p>
  
  <p>Any advice would be really helpful! </p>