arduino onboard led

I am trying to use a real-time clock, Sd card module and temperature sensors with external power supply.
so I tried to use L light as an indicator but it's not working ....please help

 #include <SD.h>
#include "DS3231.h"
//#include <RTClib.h>
#include <SPI.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>

RTClib rtcPCF;
File myFile;
#define ONE_WIRE_BUS 2
#define TWO_WIRE_BUS 3
#define THREE_WIRE_BUS 4
#define FOUR_WIRE_BUS 5
#define FIVE_WIRE_BUS 6
#define SDFILE_PIN_CS 10
#define LED 13

OneWire oneWire1(ONE_WIRE_BUS);
OneWire oneWire2(TWO_WIRE_BUS);
OneWire oneWire3(THREE_WIRE_BUS);
OneWire oneWire4(FOUR_WIRE_BUS);
OneWire oneWire5(FIVE_WIRE_BUS);
 
DallasTemperature sensors1(&oneWire1);
DallasTemperature sensors2(&oneWire2);
DallasTemperature sensors3(&oneWire3);
DallasTemperature sensors4(&oneWire4);
DallasTemperature sensors5(&oneWire5);
float temp1=0;
float temp2=0;
float temp3=0;
float temp4=0;
float temp5=0;
void setup() {
  Serial.begin(115200);
  pinMode(LED, OUTPUT);
  while (!Serial) //{; // wait for serial port to connect. Needed for native USB port only }
  sensors1.begin();
  sensors2.begin();
   Wire.begin();
  Serial.print("Initializing SD card...");
  if (!SD.begin()) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");
 }

void loop() {
  sensors1.requestTemperatures();
  sensors2.requestTemperatures();
  sensors3.requestTemperatures();
  sensors4.requestTemperatures();
  sensors5.requestTemperatures();


  
  temp1 = sensors1.getTempCByIndex(0);
  temp2 = sensors2.getTempCByIndex(0);
temp3 = sensors3.getTempCByIndex(0);
temp4 = sensors4.getTempCByIndex(0);
temp5 = sensors5.getTempCByIndex(0);
   
  DateTime now= rtcPCF.now();
  myFile = SD.open("TEMP.txt", FILE_WRITE);
  if(myFile)
  {
    Serial.print(temp1);
    Serial.print(',');
    Serial.print(temp2);
    Serial.print(',');
    Serial.print(temp3);
    Serial.print(',');
    Serial.print(temp4);
    Serial.print(',');
    Serial.print(temp5);
    myFile.print(temp1);
    myFile.print(',');
    myFile.print(temp2);
    myFile.print(',');
    myFile.print(temp3);
    myFile.print(',');
    myFile.print(temp4);
    myFile.print(',');
    myFile.print(temp5);
    myFile.print(',');
    myFile.print(now.year(), DEC);
    myFile.print('/');
    myFile.print(now.month(), DEC);
    myFile.print('/');
    myFile.print(now.day(), DEC);
    myFile.print(',');
    myFile.print(now.hour(), DEC);
    myFile.print(':');
    myFile.print(now.minute(), DEC);
    myFile.print(':');
    myFile.print(now.second(), DEC);
    myFile.println();
   myFile.close();
  }
    
    else {
    // if the file didn't open, print an error:
    Serial.println("error opening temp.txt");
    }
    //Serial.print(temp);
    Serial.print(',');
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(' ');
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    digitalWrite(LED, HIGH);
  delay(5000);
}

The SD card uses SPI and so is presumably using pin 13, which is the internal led. Can't have it both ways.

Thanks
can I use different pin with external led?

rahul4627:
Thanks
can I use different pin with external led?

Indeed, just remember it will need a resistor in series to limit the current; something like a 330 or so.

(To calculate the resistor, you will need to know the LED's voltage drop, that's about 2V say. Then the resistor needs to drop 5V - 2V = 3V (5V being the supply voltage), and limit the current to under 20mA, or 0.02A. Ohms Law says then that R= V/I = 3/0.02 =150 ohms. So if you go for a bigger resisitor of say 330, the current will be much less at about 10mA, yet the LED should still be decently bright.)