python-lib for interfacing with nRF24L01 modules
The library is to be used with python2.
- For SPI communication py-spidev: https://github.com/doceme/py-spidev.git
- For GPIO WiringPi2-Python: https://github.com/Gadgetoid/WiringPi2-Python.git
nRF24L01 RaspberryPi
+-+-+ (header) wiringpi-pins
|8|7| 1: GND -> 6 -
+-+-+ 2: 3.3V -> 1 -
|6|5| 3: CE -> 13 2
+-+-+ 4: CSN -> 15 3
|4|3| 5: SCKL -> 23 14
+-+-+ 6: MOSI -> 19 12
|2|1| 7: MISO -> 21 13
+-+-+ 8: IRQ -> not used not used
For a sender:
from nrf24 import Nrf24
nrf = Nrf24(cePin=2,csnPin=3,channel=10,payload=8)
nrf.config()
nrf.setRADDR("host1")
nrf.setTADDR("host2")
if not nrf.isSending():
nrf.send(map(ord,"Hello"))
For a receiver:
from nrf24 import Nrf24
nrf = Nrf24(cePin=2,csnPin=3,channel=10,payload=8)
nrf.config()
nrf.setRADDR("host2")
nrf.setTADDR("host1")
while True:
if nrf.dataReady():
print nrf.getData()
break