Page 1 of 1

Point-to-point Communication of Arduinos with RFM LoRa Shiel

PostPosted: Thu Mar 08, 2018 11:41 pm
by peterchua93
Hi,
for this tutorialhttps://cytrontechnologies.github.io/RFM-LoRa-Shield-Examples/Arduino-Sketches-Overview/, it just send a string from a node to the other node, but if i want to send a integer instead of string, how should i change the code?

CODE: SELECT_ALL_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();


hope there is anyone who can help here. Thanks!

Re: Point-to-point Communication of Arduinos with RFM LoRa S

PostPosted: Mon Mar 12, 2018 5:30 pm
by bengchet
Hi,

For example in transmitter

CODE: SELECT_ALL_CODE
...
String num = 1;
radiopacket += String(num);
...


For receiver, you can retrieve the number via toInt() method.