I have an issue with my code, if I use the line "LiquidCrystal lcd(rs, en, d4, d5, d6, d7);" with "SD.begin()" the connection with SD card fails. I tried troubleshooting and found out that is the line of code causing the problem. I just want to know why. Sorry if the question is not clear.
#include <SPI.h>
#include<SD.h>
#include "MFRC522.h"
#include <virtuabotixRTC.h>
#include <LiquidCrystal.h>
#define SS_PIN A2
#define RST_PIN 9
#define SP_PIN 8
virtuabotixRTC myRTC(6, 7, 8);
const int rs = A0, en = A1, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
MFRC522 rfid(SS_PIN, RST_PIN);
MFRC522::MIFARE_Key key;*/
File myFile;
int pinCS=10;
void setup() {
Serial.begin(9600);
pinMode(pinCS, OUTPUT);
// Set the current date, and time in the following format:
// seconds, minutes, hours, day of the week, day of the month, month, year
//digitalWrite(pinCS, LOW);
//digitalWrite(SS_PIN, HIGH);
if(SD.begin(10)){
Serial.println("SD card ready to use");
}else{
Serial.println("SD card initialization failed");
return;
}
myFile=SD.open("test.txt", FILE_WRITE);
if (myFile){
Serial.println("Writing to file..");
myFile.println("Testing1, 2, 3");
myFile.close();
Serial.println("Done");
}else{
Serial.println("ERROR opening");
}