/*
connections arduino RF01 and RF02

in arduino version 018
(not yet tested in more recent arduino versions)

tested with ATmega 328
on frequency 433

no range test done yet, just in one room
*/

//connections RF01: (receiving)
#define SDI             5       // RF01  SDI,  arduino  13, ATmega PB5, cannot be changed
#define SCK             4       // RF01  SCK,  arduino  12, ATmega PB4, cannot be changed
#define CS              3       // RF01  nSEL, arduino  11, ATmega PB3, cannot be changed
#define SDO             2       // RF01  SDO,  arduino  10, ATmega PB2, cannot be changed
//--------------------- // RF01  niRQ, arduino  02, ATmega PD2, cannot be changed
//----------------------// RF01  nFFS: 1-10k Pullup too Vcc


// receiving words with RF01

#include <RF01.h>

int serialTesting = 1;

void setup() {
  
  Serial.begin(9600);
  Serial.println("\nRF02 receive");
  delay(250);

  rf01_prepAll();

  delay(250);
  Serial.println("startup");
}

void loop() {
 int n;
//    unsigned char buf[] = { "$00\n" }; // Motor, Rudder
for(n=0;n<32;n++) rf01_data[n]='$';
    rf01_receive();
    char* buf = (char*) rf01_data;
    buf[31]=0;
    //if ((buf[0]=='$')&&(buf[3]=='\n')) 
    Serial.println(rf01_data);
for(n=0;n<32;n++) {Serial.print(rf01_data[n], HEX); Serial.print(' ');}
Serial.println();

    delay(700); 
  
}