2112 |
kakl |
1 |
/* |
2131 |
kakl |
2 |
RF02 TX sample for Arduino |
2112 |
kakl |
3 |
|
2131 |
kakl |
4 |
in arduino version 022 |
2112 |
kakl |
5 |
|
2131 |
kakl |
6 |
tested with MLAB modules with ATmega 328 at 16MHz |
|
|
7 |
see RF02 library for a Band and Frequency |
2112 |
kakl |
8 |
*/ |
|
|
9 |
|
2131 |
kakl |
10 |
//connections RF01: (RX) |
|
|
11 |
// RF01 SDI, arduino 13, ATmega PB5, cannot be changed |
|
|
12 |
// RF01 SCK, arduino 12, ATmega PB4, cannot be changed |
|
|
13 |
// RF01 nSEL, arduino 11, ATmega PB3, cannot be changed |
|
|
14 |
// RF01 SDO, arduino 10, ATmega PB2, cannot be changed |
|
|
15 |
// RF01 niRQ, arduino 02, ATmega PD2, cannot be changed |
|
|
16 |
// RF01 nFFS: 1-10k Pullup too Vcc |
2112 |
kakl |
17 |
|
|
|
18 |
|
|
|
19 |
// receiving words with RF01 |
|
|
20 |
|
|
|
21 |
#include <RF01.h> |
|
|
22 |
|
2131 |
kakl |
23 |
void setup() |
|
|
24 |
{ |
2112 |
kakl |
25 |
Serial.begin(9600); |
2131 |
kakl |
26 |
Serial.println("\nRFM01 init"); |
2112 |
kakl |
27 |
delay(250); |
|
|
28 |
|
|
|
29 |
rf01_prepAll(); |
|
|
30 |
|
2131 |
kakl |
31 |
Serial.println("done"); |
2112 |
kakl |
32 |
} |
|
|
33 |
|
2131 |
kakl |
34 |
void loop() |
|
|
35 |
{ |
|
|
36 |
int n; |
|
|
37 |
char* buf = (char*) _rx_buffer; |
2112 |
kakl |
38 |
|
2131 |
kakl |
39 |
rf01_rxdata(_rx_buffer, 10); |
|
|
40 |
buf[11]=0; |
|
|
41 |
|
|
|
42 |
Serial.println(buf); |
|
|
43 |
for(n=0;n<32;n++) {Serial.print(buf[n], HEX); Serial.print(' ');} |
|
|
44 |
Serial.println(); |
2112 |
kakl |
45 |
} |