2112 |
kakl |
1 |
/* |
|
|
2 |
connections arduino RF01 and RF02 |
|
|
3 |
|
|
|
4 |
in arduino version 018 |
|
|
5 |
(not yet tested in more recent arduino versions) |
|
|
6 |
|
|
|
7 |
tested with ATmega 328 |
|
|
8 |
on frequency 433 |
|
|
9 |
|
|
|
10 |
no range test done yet, just in one room |
|
|
11 |
*/ |
|
|
12 |
|
|
|
13 |
//connections RF01: (receiving) |
|
|
14 |
#define SDI 5 // RF01 SDI, arduino 13 cannot be changed |
|
|
15 |
#define SCK 4 // RF01 SCK, arduino 12 cannot be changed |
|
|
16 |
#define CS 3 // RF01 nSEL, arduino 11 cannot be changed |
|
|
17 |
#define SDO 2 // RF01 SDO, arduino 10 cannot be changed |
|
|
18 |
//--------------------- // RF01 niRQ, arduino 02 cannot be changed |
|
|
19 |
//----------------------// RF01 nFFS: 1-10k Pullup too Vcc |
|
|
20 |
|
|
|
21 |
|
|
|
22 |
// receiving words with RF01 |
|
|
23 |
|
|
|
24 |
#include <RF01.h> |
|
|
25 |
|
|
|
26 |
int serialTesting = 1; |
|
|
27 |
|
|
|
28 |
void setup() { |
|
|
29 |
|
|
|
30 |
Serial.begin(9600); |
|
|
31 |
Serial.println("\nRF02 receive"); |
|
|
32 |
delay(250); |
|
|
33 |
|
|
|
34 |
rf01_prepAll(); |
|
|
35 |
|
|
|
36 |
delay(250); |
|
|
37 |
Serial.println("startup"); |
|
|
38 |
} |
|
|
39 |
|
|
|
40 |
void loop() { |
|
|
41 |
|
|
|
42 |
rf01_receive(); |
|
|
43 |
char* buf = (char*) rf01_data; |
|
|
44 |
Serial.println(buf); |
|
|
45 |
Serial.println(" done"); |
|
|
46 |
|
|
|
47 |
delay(500); |
|
|
48 |
|
|
|
49 |
} |