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.
43 lines
728 B
43 lines
728 B
|
|
|
|
#include <SPI.h>
|
|
#include <nRF24L01.h>
|
|
#include <RF24.h>
|
|
|
|
RF24 radio(8, 9); // CE, CSN
|
|
|
|
const byte addressL[6] = "00001";
|
|
const byte addressR[6] = "00002";
|
|
|
|
int16_t dataL[6], dataR[6];
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
radio.begin();
|
|
radio.openReadingPipe(1, addressL);
|
|
radio.openReadingPipe(2, addressR);
|
|
radio.setPALevel(RF24_250KBPS);
|
|
radio.startListening();
|
|
}
|
|
|
|
void loop() {
|
|
if (radio.available()) {
|
|
|
|
radio.read(&dataL, sizeof(dataL));
|
|
|
|
for(int i=0; i<6; i++){
|
|
Serial.print(dataL[i]);
|
|
Serial.print("\t");
|
|
}
|
|
|
|
delay(50);
|
|
radio.read(&dataR, sizeof(dataR));
|
|
|
|
for(int i=0; i<6; i++){
|
|
Serial.print(dataR[i]);
|
|
Serial.print("\t");
|
|
}
|
|
|
|
Serial.println();
|
|
}
|
|
}
|