title: Ruby send string variable as hex
body: <p>How am I to express variable as hex to send like-</p>
  
  <pre><code>a='00'
  write("\x#{a}") =&gt; 0x00
  </code></pre>
  
  <p>Trying to include received string variable into command string of raw data and passed to com port like -</p>
  
  <pre><code>cmd="\x45\x#{a}\x01"
  Send(cmd)
  </code></pre>
  
  <p>In Ruby</p>
  
  <p>Thanks</p>