Arduino UNO - UARTS and HopeRF Transceiver

Hi,

I'm trying to use my HM-TRP 868D transceiver from HopeRF. http://www.hoperf.com/upload/rf_app/hm-trp.pdf

I have a Arduino Duemilanove as the client transceiver and a Arduino UNO as the server transceiver. Both Arduino's only have 1 UART. (RX/TX pins 0/1).

So I found Mike McCauley's library: http://www.open.com.au/mikem/arduino/HopeRF/HopeRF.pdf
This was written for the Arduino MEGA which has 4 UARTs.

So the question I have is this:
How can I get Mike's code to talk to my Arduino's with 1 UART. I still want to use the Serial Monitor to see data coming in through the usual Seral.write(). But also want a seperate serial to use for RX/TX for my transceiver.

I tried creating a SoftwareSerial instance and changed the libraries code to accept this but no joy.

Maybe I'm missing something obvious...

Appreciate any help.

CODE:

HRFMessage
5.1.1 HRFMessageClient
Sends an unaddressed message every second. Any HRFMEssageServer within range
will receive the message and send a reply. Test this with the HRFMessageServer below.

#include <HRFMessage.h>
// Declare the HRFMessage to use Serial1 for IO
// with the HM-TR module
HRFMessage client(&Serial1);
long lastSendTime = 0;
void setup()
{
Serial.begin(9600); // Monitoring via USB
Serial1.begin(9600); // defaults to 9600
}
void loop()
{
// Send a message to the server at most once a second
long thisTime = millis();
if (thisTime > lastSendTime + 1000)
{
client.send((uint8_t*)"test\n", 6);
Serial.print("sending\n");
lastSendTime = thisTime;
}
// But always look for a reply
uint8_t buf[HRF_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (client.recv((uint8_t*)&buf, &len))
{
// Got a reply from the server
Serial.print("got: ");
Serial.print((const char*)buf);
}
}

5.1.2 HRFMessageServer
Server to work with HRFMessageClient above. When it receives a message from
HRFMessageClient it sends a reply.
#include <HRFMessage.h>
// Declare the HRFMessage to use Serial1 for
// IO with the HM-TR module
HRFMessage server(&Serial1);
void setup()
{
Serial.begin(9600); // Monitoring via USB
Serial1.begin(9600); // defaults to 9600
Sample code
6 of 12 HopeRF
}
void loop()
{
uint8_t buf[HRF_MAX_MESSAGE_LEN];
uint8_t len = sizeof(buf);
if (server.recv((uint8_t*)&buf, &len))
{
// Got a message from the client.
// Send a reply back
server.send((uint8_t*)"reply\n", 7);
Serial.print("got: ");
Serial.print((const char*)buf);
}
}

If you go back and post your code properly, I'll have a look at it. Modify your post. Select the code, press the icon with the # on it, and save.

Even better, though, would be to back to the IDE, use Tools + Auto Format, and then copy the code again. Modify your post, select the code, delete it, press the icon with the # on it, paste the properly formatted code, and save.

It isn't your code that you are trying to modify, is it? It's the library, so posting your code is not too useful. Posting the library code, or a link to it, would be more useful.

I tried creating a SoftwareSerial instance and changed the libraries code to accept this but no joy.

No joy is functionally equivalent to "it didn't work". Useless words with no semantic content.

Posting the modified library code, and explaining what issues it has, would be a lot more useful.

i have some problem with my RF. i used HM TRP RS232 http://www.hoperf.com/rf/data_link_module/HM-TRP-RS232.htm
this is transmitter wiring with arduino mega
VCC (RF) --> 5V (Mega)
GND --> GND
RX --> RX1
TX --> TX1

and i used usb to serial in receiver. but i've got bad data.
please help

this my code
int a;

void setup(){
a=0;
Serial1.begin(9600);
delay(3000);
}

void loop(){
Serial1.println(a);
a++;
delay(100);
}

please help
thanks
sorry for my english

That code won't even compile for a Uno.

thanks for reply Paul
but i dont use Uno, i use arduino mega