import time import spidev bus=1 device=0 spi=spidev.SpiDev() spi.open(bus,device) spi.max_speed_hz = 250000 spi.mode = 0 oldstate=0 while True: data=spi.xfer2([0x55]*2, spi.max_speed_hz, 1000, 8) state=data[0]<<8 + data[1] #data.extend(spi.xfer([0x55], spi.max_speed_hz, 100)) # if state != oldstate: print(' '.join([format(d,'08b') for d in data])) oldstate=state # time.sleep(1/200)