Hello,
Regarding the item (http://www.sparkfun.com/products/8602 ); How do I know that the device is working, without having another device to receive it’s commands?
Additionally, I know that the device is set to operate on the default channel of 2, but why do you have to tell the device “hello” during initilization?
Any advice would be welcome
You can’t, easily. I’d buy one of the nRF24L01+ modules, interface it to a suitable MCU and check that you can receive the data transmitted by the Fob. I’ve got a suitable design here:
http://www.leonheller.com/MiRF%20V2/
Ok then, how can I verify that the version of the device that I got, matches the driver that is listed on the site?
Is this a case of my needing additional tools to utilize the device properly?
bennard
February 25, 2011, 12:53am
4
Do you really want to check if its working without using any receiver?
I would say use this guys circuit, with an arduino, an nrf24l01+ breakout board and see if it works:
http://innerqube.com/?p=151
Its a simple circuit with simple code. It isnt perfect but is a great way to get started. After you get it working and understand the tx/rx code, you can mod however you want.
-b
Here is some Arduino code that will work with the Nordic FOB and the nrf24l01+ from SparkFun:
/*
* Pins:
* Hardware SPI:
* MISO -> 12
* MOSI -> 11
* SCK -> 13
*
* Configurable:
* CE -> 8
* CSN -> 7
*/
#include <Spi.h>
#include <Mirf.h>
#include <nRF24L01.h>
byte data_array[4];
long DebounceDelay = 250;
long DebounceCount = millis();
void setup(){
Serial.begin(9600);
Serial.println( "Starting wireless..." );
Mirf.csnPin = 7;
Mirf.cePin = 8;
Mirf.init();
byte rx_addr[5] = {0xE7, 0xE7, 0xE7, 0xE7, 0xE7};
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();
// Read and print RF_SETUP
byte rf_setup = 0;
Mirf.readRegister( RF_SETUP, &rf_setup, sizeof(rf_setup) );
Serial.print( "Channel = " );
Serial.println( Mirf.channel, DEC );
Serial.print( "Payload = " );
Serial.println( Mirf.payload, DEC );
Serial.print( "rf_setup = " );
Serial.println( rf_setup, BIN );
Serial.println( "Wireless initialized!" );
}
void loop(){
checkwireless();
// Do other stuff
}
void checkwireless (){
if (Mirf.dataReady()){
Mirf.getData(data_array);
if (millis() - DebounceCount > DebounceDelay) {
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;
}
DebounceCount = millis();
}
else {
Serial.println ("Bounce Ignored!");
}
}
}
This code also includes simple debouncing of the received button presses.