title: ASCII decimal to string (on Arduino in C)
body: <p>I recently got some new LoRa transceivers that format data as ASCII decimals (A = 65) when sent/received. So if I send the 40-byte payload "Transmission capability demonstration...", it would be output on the receiving end as: </p>
  
  <pre><code>84 114 97 110 115 109 105 115 115 105 111 110 32 99 97 112 97 98 105 108 105 116 121 32 100 101 109 111 110 115 116 114 97 116 105 111 110 46 46 46
  </code></pre>
  
  <p>... with a little for loop like this:</p>
  
  <pre><code>for(int i = 0; i &lt; 40; i++) {
    Serial.print(trx.read());
    Serial.print(" ");
    delay(1);
  }
  </code></pre>
  
  <p>I'm decently new with data-type conversion on the Arduino platform (I have no experience handling ASCII) and haven't been able to find any simple method to convert this output into a string in C/C++. I've considered putting the complete payload into an array and converting them one-by-one using an ASCII hashmap but I would imagine there is an easier method.</p>
  
  <p><strong><em>Update:</em></strong> I ended up using jacoblaw's answer and modified it a little bit for cleaner output. At one point I had tried to use a char cast on an array without declaring which element(s) to cast, so I- at the time- thought that you could not cast a byte to a char. Not that I'm not using an array like that, the method works. Thanks for the help @jacoblaw and @Groo. Here's what I'm using now:</p>
  
  <pre><code>  for(int i = 0; i &lt; 40; i++) {
        Serial.print((char)trx.read());
        delay(1);
    }
  </code></pre>
  
  <p>If you're going to reuse this, note that you'll have to change the second "for" condition to whatever your payload length is. Thanks again!</p>