Line 9... |
Line 9... |
9 |
|
9 |
|
10 |
no range test done yet, just in one room |
10 |
no range test done yet, just in one room |
11 |
*/ |
11 |
*/ |
12 |
|
12 |
|
13 |
//connections RF01: (receiving) |
13 |
//connections RF01: (receiving) |
14 |
#define SDI 5 // RF01 SDI, arduino 13 cannot be changed |
14 |
#define SDI 5 // RF01 SDI, arduino 13, ATmega PB5, cannot be changed |
15 |
#define SCK 4 // RF01 SCK, arduino 12 cannot be changed |
15 |
#define SCK 4 // RF01 SCK, arduino 12, ATmega PB4, cannot be changed |
16 |
#define CS 3 // RF01 nSEL, arduino 11 cannot be changed |
16 |
#define CS 3 // RF01 nSEL, arduino 11, ATmega PB3, cannot be changed |
17 |
#define SDO 2 // RF01 SDO, arduino 10 cannot be changed |
17 |
#define SDO 2 // RF01 SDO, arduino 10, ATmega PB2, cannot be changed |
18 |
//--------------------- // RF01 niRQ, arduino 02 cannot be changed |
18 |
//--------------------- // RF01 niRQ, arduino 02, ATmega PD2, cannot be changed |
19 |
//----------------------// RF01 nFFS: 1-10k Pullup too Vcc |
19 |
//----------------------// RF01 nFFS: 1-10k Pullup too Vcc |
20 |
|
20 |
|
21 |
|
21 |
|
22 |
// receiving words with RF01 |
22 |
// receiving words with RF01 |
23 |
|
23 |
|
Line 36... |
Line 36... |
36 |
delay(250); |
36 |
delay(250); |
37 |
Serial.println("startup"); |
37 |
Serial.println("startup"); |
38 |
} |
38 |
} |
39 |
|
39 |
|
40 |
void loop() { |
40 |
void loop() { |
41 |
|
41 |
int n; |
- |
|
42 |
// unsigned char buf[] = { "$00\n" }; // Motor, Rudder |
- |
|
43 |
for(n=0;n<32;n++) rf01_data[n]='$'; |
42 |
rf01_receive(); |
44 |
rf01_receive(); |
43 |
char* buf = (char*) rf01_data; |
45 |
char* buf = (char*) rf01_data; |
- |
|
46 |
buf[31]=0; |
- |
|
47 |
//if ((buf[0]=='$')&&(buf[3]=='\n')) |
44 |
Serial.println(buf); |
48 |
Serial.println(rf01_data); |
- |
|
49 |
for(n=0;n<32;n++) {Serial.print(rf01_data[n], HEX); Serial.print(' ');} |
45 |
Serial.println(" done"); |
50 |
Serial.println(); |
46 |
|
51 |
|
47 |
delay(500); |
52 |
delay(700); |
48 |
|
53 |
|
49 |
} |
54 |
} |