.. highlight:: java SPI === The `SPI `_ class allows you to communicate with any sensor connected to the board on the SPI bus. Reading and writing data is done with the `readData `_ and `writeData `_ methods. Due to the number of parameters required for spi operations, a `ParameterBuilder `_ interface is provided to facilitate setting the common parameters for reads and writes. :: final SPI spi= mwBoard.getModule(SPI.class); final byte length= 5, id= 0; spi.routeData().fromId(length, id).stream("spi").commit() .onComplete(new CompletionHandler() { @Override public void success(RouteManager result) { result.subscribe("spi", new RouteManager.MessageHandler() { @Override public void process(Message msg) { Log.i("test", "SPI: " + Arrays.toString(msg.getData())); } }); spi.readData(length, id, new byte[] {(byte) 0xda}) .slaveSelectPin((byte) 10) .clockPin((byte) 0) .mosiPin((byte) 11) .misoPin((byte) 7) .useNativePins() .mode((byte) 3) .frequency(Spi.Frequency.FREQ_8_MHZ) .commit(); } });