I have written the following code
Code: Select all
import spidev
import time
spi = spidev.SpiDev() # create spi object
spi.open(0, 0) # open spi port 0, device (CS) 1
spi.mode = 0b11 # 1,1 - 3 bytes read; 0,0 - 4 bytes read
try:
while True:
resp = spi.readbytes(3) # read three bytes
print resp
time.sleep(0.1) # sleep for 0.1 secs
# end while
except KeyboardInterrupt :
spi.close()
Code: Select all
[1, 72, 82]
[255, 255, 255]
[1, 72, 14]
[255, 255, 255]
[1, 72, 81]
[255, 255, 255]
[1, 72, 91]
[255, 255, 255]
[1, 72, 85]
[255, 255, 255]
[1, 72, 127]