natevw / node-nrf

Pure-JavaScript nRF24L01 driver library
117 stars 31 forks source link

How to use this library? #56

Open MHamza81 opened 8 years ago

MHamza81 commented 8 years ago

Hi,

I want to ask you how to use this library, I know this is a very stupid question but I am doing such kind of work for the very first time. I need to your help. I have 2 Raspberry Pi 3 model B, I want them to communicate with each other using NRF24L01 (not NRF24L01+). So far i have done the following things to make it work.

Now i need to know that how should I run the tests so that I can see if devices are communicating with each other. I get the following output when i run test.js on 1st device.

Output of first device:

PING out Piping out 0 Piping out 1 Piping out 2 Piping out 3 Piping out 4 Piping out 5 Piping out 6 Piping out 7 Piping out 8 Piping out 9 Piping out 10 Piping out 11 Piping out 12 Piping out 13 Piping out 14 Piping out 15 Piping out 16


After this nothing happens. I keep the code running on other device at the same time. Output of other device is something like

Output of second device:

Piping out 4091 Piping out 4092 Piping out 4093 Piping out 4094 Piping out 4095 Piping out 4096 Piping out 4097 Piping out 4098 Piping out 4099 Piping out 4100 Piping out 4101 Piping out 4102 Piping out 4103 Piping out 4104 Piping out 4105 Piping out 4106 Piping out 4107 Piping out 4108 Piping out 4109 Piping out 4110 Piping out 4111


It runs piping out for 4111 times. The output of my test-details.js file of both the devices is as following:

Output of test-detail.js files of both devices:

SPI device: /dev/spidev0.0 CE GPIO: 24 IRQ GPIO: 25 STATUS: 0xe RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0 RX_ADDR_P0–1: 0xf1f0f0f0d2 0xf1f0f0f0e1 RX_ADDR_P2–5: 0xc3 0xc4 0xc5 0xc6 TX_ADDR: 0xf0f0f0f0e1 RX_PW_P0–5: 0x0 0x0 0x0 0x0 0x0 0x0 EN_AA: 0x3f EN_RXADDR: 0x03 RF_CH: 0x4c RF_SETUP: 0x07 CONFIG: 0x0f DYNPD/FEATURE: 0x03 0x07 Data Rate: 1Mbps Model: nRF24L01+ CRC Length: 16 bits PA Power: PA_MAX


I have no idea what am I doing wrong or how should i run the code on both devices or even if I am running the right scripts to test the libraries. I really need your help as i have no idea what I am doing and what i should be doing.

Thanks

schirag1993 commented 8 years ago

@MHamza81, you'll need to change the value of the "role" variable in the program to anything but "ping" in the second device. By doing this, one device will send data while the other receives (or listens).