anvo / rf24-bcm-java

Java wrapper for the nRF24L01 library
9 stars 5 forks source link

rf24-bcm-java

Java wrapper for the nRF24L01 library RF24 using SWIG and JNI.

Setup

  1. git clone git@github.com:anvo/rf24-bcm-java.git
  2. cd rf24-bcm-java/
  3. git submodule init
  4. git submodule update
  5. cd cpp/RF24/RPi/RF24/
  6. make
  7. cd ../../../../
  8. make wrapper

Examples

See examples/ folder.

Run

java -Djava.library.path=cpp/ -Djava.class.path=bin/ GettingStarted

Simply upload the default RF24 GettingStarted sketch onto your Arduino and start the connection.

Download

For the Raspberry Pi you can download the following compiled binaries:

Run

To run the included GettingStarted example:

java -Djava.library.path=. -jar rf24-bcm-java.jar

Error

You may get the following error:

bcm2835_init: Unable to open /dev/mem: Permission denied
#
# A fatal error has been detected by the Java Runtime Environment: 
#
#  SIGSEGV (0xb) at pc=0x42d3077c, pid=27571, tid=1086088304

The nRF24L01 library requires access to /dev/mem which is by default only possible for root:

sudo java -Djava.library.path=. -jar rf24-bcm-java.jar