Started: nRF24L01+ transceiver library for Imp (incomplete)

Hello everyone!

A couple days ago, I started writing a library for the nRF24L01+ transceiver (Datasheet) a few days ago and I thought I would share it here in case anyone wanted to use or contribute to what I have so far.

GitHub Repo:

So far, it has functions for writing one byte registers and reading registers. The configuration function checks it against a constant that is applicable for my scenario, so you will have to change that as you see fit (see function RF24_connect).

If you want to use it, use it! If you want to contribute, do a pull request. Thanks!

Nice! One very small comment is that if you are sending a constant byte string you don’t need to do:

format("%c", 0x00)

…to make the string. You can just use:


…which will be quicker (and smaller!) :slight_smile:

Thanks for the fix.

Just started working on this again after a couple day break. Now I’ll be porting over all the standard functions in the RF24 library to the imp.

Here is the link to the original RF24 library

UPDATE: Latest commit on 10/01/12: “Added RF24 functions for get_status, flush rx/tx, set_channel, and power_up/down. Added setup procedures to constructor.”

UPDATE (10/01/12 - 15:30 CST) : Added RX/TX pipe register setup. (using pipes 0 and 1)

UPDATE (10/01/12 - 19:00 CST) : code and comment cleanup

UPDATE (10/02/12 - 15:20 CST): Added a useless readme with links for some resources & changed some code formatting :stuck_out_tongue:

This is really great. thanks for sharing.

Great stuff… I’ll look into yr code and add those missing modules … a few of us manage to port the RF24 to Raspberry Pi ( ) and I hv successsfully got the attiny85 with mirf85 working with nRF24L01 and talking to the RF24 libraries ( ) …

With this driver working, we can extend the reach to other “things” without needing another impees/wires in place…

When will you finish the read and write functions? Anyone else doing it?

I found out most of the codes are not working at all… I had to re-write most of the function…

Where can I find the syntax for format() ??

Please do keep me informed. I have a bunch of them.
I will probably notice if you write here.
Let me know if I can help.

Format is like in C
format("%d %3.2f", i, f);

How do I display hex on server.log ???

The server.log display “L” and when I convert L from ASCII to Hex, I get the correct channel number of 0x4c

server.log(format("%X",i)); //untested

Sorry, it didn’t work…

What is the error message?

How do I declare an array as global ?

Put “local” outside of any function.

To create a new global array, use
a <- [];
not in any function. Using “local” outside functions should be avoided, though I admit not all our own example code follows this rule. See