Need Library source

I have a Arduino sketch which was running for about 2 years with no problems.
Due to a hardware failure I have lost the Arduino which had the sketch running.
I have all the libraries necessary to reconstruct the sketch except one.
I have it on file as " ds3231.h " however the ds3231 file I have available shows an error
"aggregate 'ts t' has incomplete type and cannot be defined.
I have reloaded several ds3231 libraries but none work or seem similar to what I had originally.
Does anybody recognise the library from the following sketch code ?

Wire.begin();
DS3231_init;

//.............................................................. SET TIME ...........
// t.hour =13; t.min = 41; t.sec = 5; t.mday = 16; t.mon =8; t.year = 2023;
// DS3231_set(t);

DS3231_get(&t);

timE();

void timE() {
Serial.print(t.mday);
Serial.print("/");
Serial.print(t.mon);
Serial.print("/");
Serial.print(t.year);
Serial.print(" ");
Serial.print(t.hour);
Serial.print(":");
Serial.print(t.min);
Serial.print(".");
Serial.println(t.sec);
Hoping someone can help
thanks

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

Please post your full sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

It is also helpful to post error messages in code tags as it makes it easier to scroll through them and copy them for examination

Searching on this method, suggests that it may be from ds3231FS - Arduino Reference However, that library is no longer maintained and seems to have disappeared from Github.

There are some copies of the library around, e.g. IoT/Library/DS3231 at 9ac3257059ab77b87c821773b4f39aa5f6f9a696 ยท khanasif1/IoT ยท GitHub

what I posted was not code but rather a written notation from my original worksheets of a section of code that I had used originally.

Thanks Bob, Had a looksee but its not the one. Originally I had tried a few but the one I eventually chose was so easy to use and east to manually update the time settings.
Tx Anyway

Silly me thinking that it was code

You will need to post the actual code if you want help. We need to see the very specific function calls, constructor, etc, used for the library in order to have any hope of finding it.

1 Like

Is the Arduino itself completely dead? If not, it might be possible to read its flash contents, and write that to a new Arduino.

Why not just modify the code to use an existing, supported library? You may have the look out for how the days of the week are numbered. Some libraries just use the chip numbering (Sunday = 1), other convert to Unix numbering (Sunday = 0).

Yes Chernoble ++

As I said I have no code to post.
What I sent was the only record I have written in a book

Thanks [xfpd]. I tried this but I could not get the Arduino to accept the Zipped file. Seems like there may be something missing from the file but tx anyway

Hi @Farticus. The problem is that this library is not formatted as an Arduino Library.

If you want to give it a try, it can be installed with simple adjustment to the file structure. I didn't look to see whether it is compatible with Arduino, but if you want to give it a try I'll provide instructions you can follow to install that library:

  1. Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
    The "Preferences" dialog will open.
  2. Take note of the path shown in the "Sketchbook location" field of the dialog.
  3. Click the "CANCEL" button.
    The "Preferences" dialog will close.
  4. Click the following link to open the library's GitHub repository homepage in your web browser:
    https://github.com/noassemblyrequired/esp32-ds3231
  5. Click the "Code โ–พ" button you see on that page.
  6. Select Download ZIP from the menu.
    A download of the ZIP file of the library will start.
  7. Wait for the download to finish.
  8. Extract the downloaded file.
  9. Move the ds3231.h file from the include subfolder of the extracted folder to the root of the extracted folder.
  10. Rename the ds3231.c file that is located the root of the extracted folder to ds3231.cpp.
    โ“˜ This is done because the .c file extension causes the library source code to be compiled as C programming language, while the .ino files of your Arduino sketches are compiled as C++. You can use objects from C libraries in a C++ program, but you need to do something special in your sketch code to accomplish that. So I think it is more simple to just rename the source code file with the .cpp file extension so that it will be compiled as C++ instead of C. C++ is a superset of C, so this shouldn't cause any problems.
  11. Copy the extracted folder to the libraries subfolder of the path you saw in the "Sketchbook location" preference.
    The folder structure of the installation must look like this:
    <Sketchbook location>/
    โ”œโ”€โ”€ libraries/
    โ”‚   โ”œโ”€โ”€ esp32-ds3231-main/
    โ”‚   โ”‚   โ”œโ”€โ”€ ds3231.cpp
    โ”‚   โ”‚   โ”œโ”€โ”€ ds3231.h
    โ”‚   โ”‚   ...
    โ”‚   ...
    ...
    
    (where <Sketchbook location> is the path from the Sketchbook location" preference)
  12. Select File > Quit (or Arduino IDE > Quit Arduino IDE for macOS users) from the Arduino IDE menus.
    All Arduino IDE windows will close.
  13. Start Arduino IDE.

Seriously, if you no longer have the code, and are having to rewrite the sketch, then just go with one of the more common, currently supported libraries.

Tx so much ptillisch. That was exactly what I needed. It worked great.
Tx also to the other respondents for the advice and help.
This enquiry can be considered closed.
Thanks all

You are welcome. I'm glad it is working now.

Regards, Per