This is a work in progress for an NRF2401P
Dependents: NRF_receiver sender locker4 Weather_Station_Ofiicial ... more
About
This is a simple library to drive the nRF24l01+.
Hardware
This uses the commonly available breakout. The connections are shown below
Software
Use case: For a simple transmitter
tx code snipet
#include "NRF2401P.h" int main() { * * long long addr1=0xAB00CD; // setup address - any 5 byte number - same as RX * int channel =0x12; // [0-126] setup channel, must be same as RX * bool txOK; * char msg[32]; * char ackData[32]; * char len; * * // Setup * NRF2401P nrf1(PTD6,PTD7, PTD5,PTD4, PTC12); //mosi, miso, sclk, csn, ce) * nrf1.quickTxSetup(channel, addr1); // sets nrf24l01+ as transmitter * * // transmit * strcpy (msg, "Hello"); * txOK= nrf1.transmitData(msg,strlen(msg)); * * // read ack data if available * if (nrf1.isAckData()) { * len= nrf1.getRxData(ackData); // len is number of bytes in ackData * } *}
Use case: For a simple receiver
rx code snipet
#include "NRF2401P.h" *int main(){ * * long long addr1=0xAB00CD; // setup address - any 5 byte number - same as TX * int channel =0x12; // [0-126] setup channel, must be same as TX * bool txOK; * char msg[32]; * char ackData[32]; * char len; * * // Setup * NRF2401P nrf1(PTD6,PTD7, PTD5,PTD4, PTC12); //mosi, miso, sclk, csn, ce) * nrf1.quickRxSetup(channel, addr1); // sets nrf24l01+ as receiver, using pipe 1 * * // set ack data * sprintf(ackData,"Ack data"); * nrf1.acknowledgeData(ackData, strlen(ackData),1); // ack for pipe 1 * * // receive * while (! nrf1.isRxData()); // note this blocks until RX data * len= nrf1.getRxData(msg); // gets the message, len is length of msg * *}
History
Minor updates to make all returns void if possible
2016-02-25, by epgmdm [Thu, 25 Feb 2016 09:44:11 +0000] rev 20
Minor updates to make all returns void if possible
Next update;
2016-02-19, by epgmdm [Fri, 19 Feb 2016 14:03:31 +0000] rev 19
Next update;
updates;
2016-02-08, by epgmdm [Mon, 08 Feb 2016 00:09:12 +0000] rev 18
updates;
Updated;
2016-02-07, by epgmdm [Sun, 07 Feb 2016 22:34:47 +0000] rev 17
Updated;
Makes the easy tx and rx include ack
2016-01-28, by epgmdm [Thu, 28 Jan 2016 14:37:32 +0000] rev 16
Makes the easy tx and rx include ack
Cleaned up code. most functions now return void. Status is tracked in the class. Use checkStatus().
2015-06-18, by epgmdm [Thu, 18 Jun 2015 20:54:25 +0000] rev 15
Cleaned up code. most functions now return void. Status is tracked in the class. Use checkStatus().
Minro housekeeping.
2015-07-11, by nixonkj [Sat, 11 Jul 2015 22:17:36 +0000] rev 14
Minro housekeeping.
Provides isRPDset() - check if radio signal > -64dBm.
2015-07-11, by nixonkj [Sat, 11 Jul 2015 21:20:56 +0000] rev 13
Provides isRPDset() - check if radio signal > -64dBm.
Fix CONFIG missing in printDetails
2015-07-11, by nixonkj [Sat, 11 Jul 2015 16:44:50 +0000] rev 12
Fix CONFIG missing in printDetails
Refactored printDetails and introduced printReg functions.
2015-07-11, by nixonkj [Sat, 11 Jul 2015 14:56:17 +0000] rev 11
Refactored printDetails and introduced printReg functions.