TinyCircuits

How do the Micro SD shield and Led pin 13 interact? Do they interfere?

If I load the good old "blink" sketch, my tiny duino behaves as expected. However, I seem to be getting odd behavior out of the indicator led on pin 13, once I start sd card operations.  Can anyone with more experience explain how those two functions get along on pin 13?

Half the time the indicator led works, and half the time it will not light up with the standard "digitalWrite(13, HIGH);" line.

Re: How do the Micro SD shield and Led pin 13 interact? Do they interfere?
« Reply #1 on: December 09, 2013, 08:55:32 PM »
This is actually expected - the LED on pin 13 is also shared with the SPI SCLK clock, which is used by the microSD card TinyShield.  So when you use a SPI device like the SD card, the LED will blink, and the SD library will override the digitalWrite() function call.  This is also just how it works on the Arduino Uno, which is why we used the same pin for the LED.

If you need a LED for indication, you'll need to hook up an external one to a different I/O pin.

Thanks!

Ken Burns
TinyCircuits





Re: How do the Micro SD shield and Led pin 13 interact? Do they interfere?
« Reply #2 on: December 12, 2013, 12:00:53 PM »
Well this is reasonably OK for me, as its the SD card writes that I am trying to warn the user about with the warning led... So I guess my real question is, can I somehow mess up the SD card writing by putting High/Low write statements in the code for the led pin? or will the SD clk always trump any previous settings to make sure the writes go ok....

Re: How do the Micro SD shield and Led pin 13 interact? Do they interfere?
« Reply #3 on: December 15, 2013, 03:37:27 PM »
The SD card will be fine, since SPI is enable the digitalWrite() call will not toggle the pin.

Thanks,

Ken
TinyCircuits