title: Difference between unsigned short and unsigned char in LoRa communication
body: <p>I am working on establishing a lora communication between a gateway (RPI3 + LoRa hat) and a node (RPi3 + LoRa hat). As I would like to establish the communication channel without TTN, I tried the following example to setup communication between the two: <a href="https://github.com/dragino/rpi-lora-tranceiver/blob/master/dragino_lora_app/main.c" rel="nofollow noreferrer">https://github.com/dragino/rpi-lora-tranceiver/blob/master/dragino_lora_app/main.c</a></p>
  
  <p>The code works well on both as both the sender and receiver ends. That means that on the sender side, the message to be sent is being printed on the console. And on the receiver side, the received message is being displayed.</p>
  
  <p>This works well for short messages. However, I would like to send a message that is 600 bytes long. In order to send this long message, I edited typedef of <code>writeBuf()</code> argument as follows:</p>
  
  <pre><code>static void writeBuf(byte addr, byte *value, unsigned short len) {
  </code></pre>
  
  <p>I made this change because <code>byte len</code> was limiting message to be sent to 255 (due to the range of unsugned char which is 0-255). And so I needed to extend this range so that I can send a longer message. With this change being made, no message is being printed in the console. The for loop within <code>writeBuf()</code> goes from 0-n and then from 99-n continuously with no send message being printed on the console. Hence, the receiver is never receiving any message. I understand the difference between <code>unsigned short</code> and <code>unsigned char</code>. However, I am not able to understand the difference between <code>unsigned short</code> and <code>unsigned char</code> in this context. Any help/guidance would be highly appreciated. I would also like to know if I am making the right changes or looking at the right direction or not.</p>
  
  <p>Thank you </p>