I've got them communicating, I think. Using my Nano as a Transmitter and my Mega as the Receiver. The Sparkfun site says that the transmitter transmits on either 2400baud or 4800baud. I've tried both, to no avail. It seems to be working, as if I disconnect the nano, the mega prints 0's, but i can't make it send any kind of useful information.
#include <SoftwareSerial.h>
// Receiver
#define rxPin 2
#define txPin 3
SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin);
int received = 0;
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
rfSerial.begin(4800);
Serial.begin(2400);
}
void loop()
{
received = rfSerial.read();
Serial.println(received);
}
#include <SoftwareSerial.h>
// Transmitter
#define txPin 3
#define rxPin 2
SoftwareSerial rfSerial = SoftwareSerial(rxPin, txPin);
byte val = 0;
int counter = 1111;
void setup()
{
rfSerial.begin(4800);
}
void loop()
{
rfSerial.print(counter);
//counter++;
delay(10);
}
That's my code. The output is very erratic, I can't decipher a meaning out of it. It just prints random numbers.
64
16
240
196
101
48
177
9
32
0
25
59
47
14
1
158
24
112
6
25
19
9
2
130
4
231
196
13
8
38
168
32
204
128
0
66
15
132
188
115
53
-1
161
9
12
4
130
78
164
2
16
67
131
137
31
96
240
0
201
196
195
128
30
62
11
168
48
-1
100
0
23
135
88
26
2
8
69
132
72
4
57
0
144
29
98
137
206
152
48
196
192
68
234
64
51
144
32
228
64
226
24
0
131
32
105
238
243
160
128
33
14
8
100
239
25
16
6
-1
147
-1
152
4
196
16
29
8
2
68
20
232
163
8
204
0
199
130
176
56
192
11
17
96
16
32
129
239
130
12
16
129
3
115
247
66
41
56
128
16
209
15
128
84
16
18
0
48
16
24
39
196
148
186
123
0
0
128
200
31
19
129
224
128
197
146
80
4
0
224
14
0
35
48
16
12
232
0
138
5
96
200
130
5
241
194
46
0
239
0
131
96
217
0
41
53
31
7
16
148
225
0
1
66
136
22
145
80
32
32
146
204
154
0
192
189
19
239
0
64
98
208
41
33
0
56
72
194
3
224
224
1
32
64
1
97
140
208
69
132
0
12
16
33
0
0
100
7
49
49
192
15
120
231
10
192
0
64
1
129
96
145
1
142
108
4
128
-1
6
224
224
56
31
55
6
168
132
64
I found another thread about this on the board, that's where I got the basis for this code, but it just doesn't seem to work. Anyone know what is going wrong? I can't tell if its the code thats wrong or the transmitter or receiver, or if its something else.