1

I am building a arduino based bicycle speedometer with time and temperature display.

Im currently stuck with the DS3231 (zs-042) chip. I found online a lot of library issues, i tried using multiple libraries (Rinky-Dink, ds3231-master) but nothing works. I found a simple code online to test the chip but when I upload it the following error shows up: "no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)"

#include <Wire.h>
#include <DS3231.h>
DS3231  rtc(SDA, SCL);

void setup()
{
  Serial.begin(115200);
  
  // Initialize the rtc object
  rtc.begin();
  rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY
  rtc.setTime(12, 0, 0);     // Set the time to 12:00:00 (24hr format)
  rtc.setDate(1, 1, 2014);   // Set the date to January 1st, 2014
}

void loop()
{
  // Send Day-of-Week
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");
  
  // Send date
  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  // Send time
  Serial.println(rtc.getTimeStr());
  
  // Wait one second before repeating :)
  delay (1000);
}

The error occurs in the third line (rtc (SDA,SCL)) - I have checked the pins and switched the battery on the chip. I also tried using A4 and A5 instead of SDA and SCL pins...

Any type of help would be awesome.

Best regards, Marin

1 Answer 1

2

Alright I found the problem.

https://www.youtube.com/watch?v=BM3A7w3bhqM&ab_channel=MERTKILIC

In this video at 5:00 you can see the following:

First you have to download the library, unzip it and copy the files inside.

You will have to paste it to your Arduino/Libraries/DS3231 folder.

On the left is the current DS3231 Library which I added through the arduino library manager. Its not the same as the one the right, it should be, but its not, copy the files from the unzipped DS32321 library into the Arduino/library/DS3231.

Works fine now !

2
  • 1
    Any reason why you did not simply install it via the Library Manager?
    – StarCat
    Sep 9, 2020 at 11:16
  • 1
    I did and it didnt work Sep 9, 2020 at 18:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.