The Serial Peripheral Interface (SPI) is a protocol for communication between a master and a few slave devices. It is very fast because the communication is synchronous and the clock is maintained by the master device. The master decides when to talk with each slave, and the data transfer happens on the Master-In-Slave-Out (MISO) and Master-Out-Slave-In (MOSI) lines.
In[1]:=
Needs["MicrocontrollerKit`"]
In this example, code is deployed to an Adafruit ItsyBitsy 32u4 - 5V to read the temperature from a MAX6675 SPI sensor, turn on an LED when the temperature is within the desired range and turn on a buzzer when it is not:
The systems model with one input for the temperature and two outputs for the LED and buzzer:
Whether it is moving an input or output to a different pin, changing a sensor, adding an additional output, etc., these can be specified much more efficiently and quickly in high-level Wolfram Language code.