Earlier I was faffing on with serial comms between two arduinos. Thanks to Coding Badly for sorting that one out for me. The reason I was doing that is that I've got a pair of RF modules that I couldn't get working.
Now I've got serial comms working I've tested the RF modules and can't get it working.
I'm using the RF Tx and Rx modules from bitsbox: http://www.bitsbox.co.uk/sensors.html#rf (the data sheets are available on that link).
On the transmitter arduino I've got the Tx module wired up like this:
Pin 1: +5v
Pin 2: GND
Pin 3: Arduino digital pin 3
Pin 4: Jumper cable connected to nothing (for an antenna).
I'm running the following code:
#include <NewSoftSerial.h>
NewSoftSerial sender(2,3);
int i = 0;
void setup()
{
sender.begin(4800);
Serial.begin(9600);
delay(1000);
}
void loop()
{
sender.print(i);
sender.print (", ");
Serial.print(i);
Serial.print (", ");
i++;
delay(1000);
}
On the second arduino I've got the receiving module wired up like this:
Pin 1: +5v
Pin 2: GND
Pin 3: Nothing
Pin 7: GND
Pin 10: +5v
Pin 11: GND
Pin 12: +5v
Pin 13: Nothing
Pin 14: Arduino pin 3
Pin 15: +5v
I'm run the following code:
#include <NewSoftSerial.h>
NewSoftSerial rec(3,2);
void setup()
{
rec.begin(4800);
Serial.begin(9600);
delay(1000);
}
void loop()
{
if (rec.available() > 0) {
Serial.print((char)rec.read());
}
}
When I run it I get vast amounts of random characters.
If I unhook pin 3 I don't get anything.
The output looks different if the Tx arduino isn't running.
Any suggestions, please?