You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
679 B
42 lines
679 B
|
|
#include <SPI.h>
|
|
#include <nRF24L01.h>
|
|
#include <RF24.h>
|
|
|
|
RF24 radio(8, 9);
|
|
|
|
const uint64_t rAddress[] = {0x7878787878LL, 0xB3B4B5B6F1LL};
|
|
|
|
void setup(){
|
|
|
|
Serial.begin(9600);
|
|
radio.begin();
|
|
|
|
radio.setPALevel(RF24_PA_LOW);
|
|
radio.setChannel(108);
|
|
|
|
radio.openReadingPipe(0,rAddress[0]);
|
|
radio.openReadingPipe(1,rAddress[1]);
|
|
radio.startListening();
|
|
}
|
|
|
|
void loop(){
|
|
|
|
int pipes = 2;
|
|
int16_t data[] = {0,0,0,0,0,0};
|
|
|
|
for(byte p=0; p<pipes; p++){
|
|
if(radio.available(p)){
|
|
|
|
radio.read( &data, sizeof(data) );
|
|
for(byte i=0; i<6; i++){
|
|
Serial.print(data[i]);
|
|
Serial.print("\t");
|
|
}
|
|
}
|
|
}
|
|
|
|
Serial.println();
|
|
delay(200);
|
|
}
|
|
|