Showing Unreadable text the moment I open Serial Monitor

I tried to set time on a RTC DS3231. After Uploading it with Arduino IDE, I try viewing the output in the Serial Monitor. However, if I start viewing the Serial Monitor, It starts showing encrypted lines. I have tried the example code and yet it shows the same error.

The Setup Code:

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

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

  rtc.begin();


  rtc.setDOW(SUNDAY);    
  rtc.setTime(02, 17, 0);   
  rtc.setDate(29, 03, 2020);  
}

And the loop code looks like this

void loop()
{
  Serial.print(rtc.getDOWStr());
  Serial.print(" ");


  Serial.print(rtc.getDateStr());
  Serial.print(" -- ");

  Serial.println(rtc.getTimeStr());

  delay (1000);
}

The Screenshot of the Output:

Serial monitor baud rate set to 9600. Serial baud rate in setup() of sketch is set to 115200. The baud rates need to match.

Hi,
Welcome to the forum.

Karma for using code tags.

What model Arduino are yo using?

Thanks… Tom… :slight_smile: