// include the SPI library: #include const int slaveSelectPin = 10; void setup() { // set the slaveSelectPin as an output: pinMode (slaveSelectPin, OUTPUT); // Initializaree SPI: SPI.begin(); SPI.setBitOrder(MSBFIRST); // MSBFIRST 0x00 SPI.setDataMode(SPI_MODE0); // SPI_MODE0 0x00 SPI.setClockDivider(SPI_CLOCK_DIV4); // SPI_CLOCK_DIV4 0x00 } void SPIClass::begin() { // Set SS to high so a connected chip will be "deselected" by default digitalWrite(SS, HIGH); // When the SS pin is set as OUTPUT, it can be used as // a general purpose output port (it doesn't influence // SPI operations). pinMode(SS, OUTPUT); // Warning: if the SS pin ever becomes a LOW INPUT then SPI // automatically switches to Slave, so the data direction of // the SS pin MUST be kept as OUTPUT. SPCR |= (1<