Hello
I have a RS 485 converter and two Lora Feather Boards. The data is provided to the RS 485 converter vis putty and this data is transferred to first Lora Feather Board via serial communication. This data from first LORA feather board is transferred wirelessly to the second LORA feather board using the Radiohead library available on the LORA website. I am able to transfer the data from RS485 to first LORA board via serial communication. However, I am having issues in transferring the data using the Radiohead library to the second feather board. For example, if I am trying to send char 'a' using the library, on the second Lora feather board I am receiving the data but it is received in binary form. For example, if I send char 'a', I am receiving the binary version of 'a' i.e 1100001.
Can anyone help me on this issue?
Trasnmitter side code:
char *p = bufRX485, str, br, output[9];
int i , n , rs485count = 0;
for (i = 0; i <= 1000; i++) {
if (Serial1.available()) {
br = Serial1.read();
Serial.println(br);
*p = br;
p++;
rs485count++;
itoa(br, output, 2);
puts(output);
++br;
rf95.send((uint8_t*)output, sizeof(output));
rf95.waitPacketSent();
Receiver Side code:
uint8_t buf[RH_RF95_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (rf95.recv(buf, &len))
{
digitalWrite(LED, HIGH);
RH_RF95::printBuffer("Received: ", buf, len);
Serial.print("Got: ");
Serial.println((char*)buf);
Serial.print("RSSI: ");
Serial.println(rf95.lastRssi(), DEC);
Thanks in advance
Radiohead Library for data transmission
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Radiohead Library for data transmission
Try using this to convert the byte array into a String object:
Code: Select all
String str = String( buf );
- vishu_fcb
- Posts: 7
- Joined: Sat Dec 01, 2018 6:31 pm
Re: Radiohead Library for data transmission
I tried using the command:
String str = String( buf );
But it shows the following error:
call of overloaded 'String(uint8_t [251])' is ambiguous
String str = String( buf );
But it shows the following error:
call of overloaded 'String(uint8_t [251])' is ambiguous
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Radiohead Library for data transmission
Try adding an explicit typecast:
Code: Select all
String str = String( (unsigned char *)buf );
- vishu_fcb
- Posts: 7
- Joined: Sat Dec 01, 2018 6:31 pm
Re: Radiohead Library for data transmission
I tried but it still shows this error :
call of overloaded 'String(unsigned char*)' is ambiguous
is there any specific type casting problem?
call of overloaded 'String(unsigned char*)' is ambiguous
is there any specific type casting problem?
- adafruit_support_mike
- Posts: 67446
- Joined: Thu Feb 11, 2010 2:51 pm
Re: Radiohead Library for data transmission
The Arduino IDE adds a bunch of type interpolation rules to make the low-level libraries compile properly, and sometimes that creates problems for other code.
Check over in the Arduino forums:
http://forum.arduino.cc/
The folks there will have the most recent information.
Check over in the Arduino forums:
http://forum.arduino.cc/
The folks there will have the most recent information.
Please be positive and constructive with your questions and comments.