Using pins 19, 20, 21 and 22 as extra digital I/O pins

The SAM D21 pins 19, 20, 21 and 22 are not connected to the pin headers, but I want to use them as digital I/O pins D14, D15, D16, D17, just as D0, D1 etc. How can I do this?

These pins constitute the SPI port on the Zero’s 6 pin header, with the exception of pin 22 which is the ATN pin, (on pin header next to the IOREF). (Note: The M0/M0 Pro omits the ATN pin).

The pins are named as follows:

Pin 19 - MOSI
Pin 20 - SCK
Pin 21 - MISO
Pin 22 - ATN

For example to write a logic HIGH to the MOSI pin:

pinMode(MOSI, OUTPUT);      // Set the MOSI pin to an output
digitalWrite(MOSI, HIGH);   // Set the MOSI pin HIGH

MartinL:
These pins constitute the SPI port on the Zero's 6 pin header, with the exception of pin 22 which is the ATN pin, (on pin header next to the IOREF). (Note: The M0/M0 Pro omits the ATN pin).

The pins are named as follows:

Pin 19 - MOSI
Pin 20 - SCK
Pin 21 - MISO
Pin 22 - ATN

For example to write a logic HIGH to the MOSI pin:

pinMode(MOSI, OUTPUT);      // Set the MOSI pin to an output

digitalWrite(MOSI, HIGH);  // Set the MOSI pin HIGH




Thanks very much.