Introduction to SPI Pins
The SPI Pins function allows users to configure the Serial Peripheral Interface (SPI) signalling pins on the micro:bit. This is essential for establishing communication with external devices using SPI connections. Each SPI signal line is assigned to a unique pin, enabling effective data transfer. The three main signalling lines are:
- MOSI (Master Out Slave In): Data output pin
- MISO (Master In Slave Out): Data input pin
- SCK (Serial Clock): Clock output pin
By default, the micro:bit assigns the following pins:
- P15 for MOSI
- P14 for MISO
- P13 for SCK
Users can customize these assignments using the pins.spiPins() function, which takes the desired pin numbers as parameters. This flexibility is crucial for various applications, including sensor integration and communication with other microcontrollers.

