Skip to content
Browse files

Adding test script that talks to a nRF device over SPI

  • Loading branch information...
1 parent 439eaca commit 95b4426575cc5495d47196f58bbc1024550bb874 @fake-name fake-name committed Mar 17, 2013
Showing with 20 additions and 0 deletions.
  1. +20 −0 test-nRF.py
View
20 test-nRF.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+
+
+import spi
+
+# This is a very simple script that uses the rPi SPI port to read out the various registers in a nRF24L01+ device
+# connected to the rPI SPI port 0
+# It should be pretty self-explanitory
+
+
+status = spi.openSPI(speed=1000000)
+print "SPI configuration = ", status
+
+print "Reading nRF24L01 status registers:"
+
+for x in range(28):
+ dat = spi.transfer((x, 0))
+ print "nRF Register 0x%X: %X" % (x, dat[1])
+
+spi.closeSPI()

1 comment on commit 95b4426

@meayd30

Hi
After I have installed the SPI-py
I run the test-nRF.py

but I get error that: AttributeError: 'module' object has no attribute 'openSPI'

How can I fix that error.

Please sign in to comment.
Something went wrong with that request. Please try again.