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

Bluetooth, XBee, RF......

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

Postby peterchua93 » Thu Mar 08, 2018 11:41 pm

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!
peterchua93
Freshie
 
Posts: 6
Joined: Wed Mar 07, 2018 10:45 pm

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

Postby bengchet » Mon Mar 12, 2018 5:30 pm

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.
bengchet
Amateur
 
Posts: 237
Joined: Tue Aug 25, 2015 8:29 am


Return to Wireless Device

Who is online

Users browsing this forum: No registered users and 26 guests

cron