DS1302 Setup

not printing this also? then your device is corrupted i guess.

When i use only SD card module, in serial monitor it is shown.

But when i use SD card and Rrc module in serial monitor is shown nothing.

What do i need to do??

maybe google search on how to connect SD card to nodemcu.

here you have 2, 3, 4 and

here you have mentioned D1, D2, D3. First, learn which are the nodemcu pinout and how they are mapped with GPIO.

I have searched on google.

When I connect only Rtc with ESP8266, i use pins D1, D2,D3. And i can setup time and date.

I dont know why it is not working in this project.

can you share this code.

Sorry, In the code i have changed pins for
Rrc.

I am using pins D1(5), D2(4) and D3(0).

I have used this code to setup time and date.

#include <MyRealTimeClock.h>

MyRealTimeClock myRTC(5,4,0); // Assign Digital Pins

void setup() {
Serial.begin(115200);

/* To set the current time and date in specific format
| Second 00 | Minute 11 | Hour 21 | Week Day 06 | Day 17 | Month 8 | Year 2019 |
*/

myRTC.setDS1302Time(00, 9, 17, 05, 24, 7, 2020);
}

void loop() {

// Allow the update of variables for time / accessing the individual element.
myRTC.updateTime();

Serial.print(“Current Date / Time: “);
Serial.print(myRTC.dayofmonth); // Element 1
Serial.print(”/”);
Serial.print(myRTC.month); // Element 2
Serial.print(“/”);
Serial.print(myRTC.year); // Element 3
Serial.print(" “);
Serial.print(myRTC.hours); // Element 4
Serial.print(”:“);
Serial.print(myRTC.minutes); // Element 5
Serial.print(”:");
Serial.println(myRTC.seconds); // Element 6
delay( 5000);
}

you are using this libray here and in the combined code it is totally different?

I have changes the code, but this error is shown:
Error compiligin for board NodeMCU 1.0 (ESP-12E Module).

#include <MyRealTimeClock.h>

#include <SD.h>

MyRealTimeClock rtc(5, 4, 0);

#define CS_PIN D8
File myFile;

void setup() {
Serial.begin(115200);
Serial.print(“Initializing SD card…”);

if (!SD.begin(CS_PIN)) {
Serial.println(“initialization failed. Things to check:”);
Serial.println(“1. is a card inserted?”);
Serial.println(“2. is your wiring correct?”);
Serial.println(“3. did you change the chipSelect pin to match your shield or module?”);
Serial.println(“Note: press reset or reopen this serial monitor after fixing your issue!”);
while (1);
}

Serial.println(“initialization done.”);

myFile = SD.open(“test.txt”, FILE_WRITE);
// if the file opened okay, write to it:
if (myFile) {
Serial.print(“Writing to test.txt…”);
myFile.print(“temperature”);
myFile.print(" | ");
myFile.println(“humidity”);

Serial.print(“Current Date / Time: “);
Serial.print(rtc.dayofmonth); // Element 1
Serial.print(”/”);
Serial.print(rtc.month); // Element 2
Serial.print(“/”);
Serial.print(rtc.year); // Element 3
Serial.print(" “);
Serial.print(rtc.hours); // Element 4
Serial.print(”:“);
Serial.print(rtc.minutes); // Element 5
Serial.print(”:");
Serial.println(rtc.seconds); // Element 6
delay( 5000);

// close the file:
myFile.close();
Serial.println("done.");

} else {
// if the file didn’t open, print an error:
Serial.println(“error opening test.txt”);
}
}

void loop() {
}

does not provide much info on this.

Can you help me to create a code that works please ?

I am trying but its not working.

no i cant, because you are not doing anything beside copy and pasting. Also, the code your using worked but then you combined and it is giving error. But the error you shared gives no details about what actually is the error.

Its not just a copy paste, but ok.

Thanks.