An SPI library is now included in the Arduino software. See the SPI library reference for details.

Why doesn't my LED turn on after starting SPI ?

Why doesn't "digitalWrite(ledPin, HIGH);" work after starting SPI -- why doesn't my LED turn on?

After executing "SPI.begin();", the command "digitalWrite(ledPin, HIGH);" appears to do nothing.

Executing "SPI.begin();" configures the SCK and MOSI pins to be directly managed by the SPI hardware. The SCK pin is Arduino pin 13, the LED pin. The MOSI pin is Arduino pin 11.

How can I regain control of the LED pin?

Executing "SPI.end();" allows those pins to be used as general I/O again.

(The above pin numbers are for the ATmega328P-based Arduinos such as the Uno or Duemilanove. For other Arduinos, see the SPI library pin number reference ).

Share