I had a hard time getting this to work even with examples on the the arduino forum. It seems that it needs the command Mirf.spi = &MirfHardwareSpi; to get going. Anyway, the purpose of this vid is to post the code to help other idiots like myself:
** notes its a standard config:
MISO = 12 , MOSI = 11 , SCK = 13 , CE = 8 , CSN = 7
The VCC is direct to 5v on the ardiono and GND to GND of course.
// note you need to put the arrows around these 4 #include as youtube wont allow this character in the desc for some reason.
#include SPI.h
#include Mirf.h
#include nRF24L01.h
#include MirfHardwareSpiDriver.h
byte data_array[4];
void setup() {
Mirf.spi = &MirfHardwareSpi;
Mirf.csnPin = 7;
Mirf.cePin = 8; Mirf.init();
// delay(50); Mirf.setRADDR(rx_addr);
Mirf.configRegister(RF_SETUP, 0x07); //Air data rate 1Mbit, 0dBm, Setup LNA
Mirf.configRegister(EN_AA, 0x00); //Disable auto-acknowledge
Mirf.payload = 4;
Mirf.channel = 2;
Mirf.config();
Serial.begin(9600);
}
void loop(){ if (Mirf.dataReady()){ Serial.print("Data! : "); Mirf.getData(data_array); Serial.println(data_array[0],HEX); switch (data_array[0]) {
case 0x1D: Serial.println("UP"); break;
case 0x1E: Serial.println("DOWN"); break;
case 0x17: Serial.println("LEFT"); break;
case 0x1B: Serial.println("RIGHT"); break;
case 0x0F: Serial.println("CENTER"); break;
default: break; }
}
}
good pages from arduino:
http://www.arduino.cc/playground/InterfacingWithHardware/Nrf24L01, you only need Mirf.h download from this page as the other .h files (nRF24L01.h , MirfHardwareSpiDriver.h ) are inside Mirf.h
Whats this program do: Simply press the FOB and get word 'UP', press down 'DOWN'...e.t.c. outputted to your computer (press serial monitor button after you upload the program)
any luck finding your file?
forbzy91 3 months ago
Tried using the code exactly as you posted, I am using the same fob but the nRF24L01+ Module with RP-SMA connector. would not work at all, is the line // delay(50); Mirf.setRADDR(rx_addr);
supposed to be commented? i uncommented the second half but would not compile as rx_addr is not defined.
is Mirf.setRADDR meant to point to the data array?
forbzy91 3 months ago