Point-to-point Communication of Arduinos with RFM LoRa Shield In this tutorial, it sends a string from a node to the other node. But if I want to send an integer instead of a string, how should I change the code?

Serial.println("Sending to rf95_server");
// Send a message to rf95_server

String radiopacket = "Hello World #";
radiopacket += String(packetnum++);
radiopacket += " from ";
radiopacket += node_id;

Serial.print("Sending "); Serial.println(radiopacket); delay(10);
rf95.send((uint8_t*)radiopacket.c_str(), radiopacket.length()+1);

Serial.println("Waiting for packet to complete..."); delay(10);
rf95.waitPacketSent();
The simplest way is to just cast the integer into an array of 2 bytes and send that.  Assuming int temperature:

rf95.send((uint8_t *)&amp;temperature, 2);


To make it more portable you can use the size of an integer instead of 2:

rf95.send((uint8_t *)&amp;temperature, sizeof(int));


Reading back, you just cast the buffer you have received as an integer, or combine the data manually (which may be safer since the buffer may be misaligned on a more powerful system than an 8 bit Arduino):

int temperature = buf[0] | (buf[1] &lt;&lt; 8);


(Assuming it was sent from a little-endian 8-bit system).

If you want to send the number as plain text, so it can be easily read by a human, you want to print it to a string:

char temp[6];
sprintf(temp, "%d", temperature);
rf95.send((uint8_t *)temp, strlen(temp));