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

EKMallon

  • Full Member
  • ***
    • Posts: 27
    • View Profile
    • The Cave Pearl Project
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.


TinyCircuits

  • Administrator
  • Hero Member
  • *****
    • Posts: 107
    • View Profile
    • TinyCircuits Homepage
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






EKMallon

  • Full Member
  • ***
    • Posts: 27
    • View Profile
    • The Cave Pearl Project
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....


TinyCircuits

  • Administrator
  • Hero Member
  • *****
    • Posts: 107
    • View Profile
    • TinyCircuits Homepage
The SD card will be fine, since SPI is enable the digitalWrite() call will not toggle the pin.

Thanks,

Ken
TinyCircuits


 

SMF spam blocked by CleanTalk