1

I have a circuit in which I'm using an Arduino Pro Mini to interface with an RF69 radio via SPI. The SCK pin on the Pro Mini is pin 13, which also happens to be the LED pin. Is it possible to write pin 13 high and low in the same sketch that I'm interfacing with the radio? I don't need to do SPI communication simultaneously with the LED. I can put the radio to sleep then use the LED. I'm wondering if this will some how mess up the SPI communication or if everything will be OK.

  • probably, but just try it, it won't zap anything... – dandavis Mar 1 '17 at 22:43
  • 1
    You need to disable SPI before you use digitalWrite on the SPI pins, or nothing will happen! Then re-enable SPI when you start communication again. – Gerben Mar 2 '17 at 17:26
4

I did not check the datasheet of the RF69, but it is customary for SPI devices to have a “slave select” input pin. When such a device is not selected, it will leave its MISO pin in high impedance and completely ignore whatever may happen on the MOSI and SCK pins. This effectively disconnects the device from the SPI bus. In this situation you show be able to play with the LED without disturbing the device.

Beware that the slave select pin is usually active low: write it to HIGH to deselect the device.

  • Great, thank you. This is exactly what I needed. – Alex Wulff Mar 2 '17 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.