This is very simple test code. I put in serial.println so I could monitor the status. I'm getting corrupted text on the
serail, "⸮Y", I've tried several different baud rates. I get different corrupted output. Serial works fine if I don't use
RTClib, for example "blink". I've get the same results on Arduino Uno, Mega and Metro.
#include "RTClib.h"
RTC_DS3231 rtc;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
Serial.println("Testing time");
if(now.hour() >= 23 && now.minute() > 00){
Serial.println("it's night time, turning OFF");
}
else {
Serial.println("Day light everything ON");
}
//if(now.hour() == 6 && now.minute() == 00){
}
DS3231 problems with serial.print
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: DS3231 problems with serial.print
Have you tried printing what now.hour and now.minute is?
- eeyore124
- Posts: 12
- Joined: Fri Nov 09, 2012 3:21 pm
Re: DS3231 problems with serial.print
Yes. It was working for a bit. Even the example that comes with the RTClib, ds3132m this lets you set the time and
prints the time to serial. This worked for a short time and then I get the same problem. I've tried this on two
windows machines (win10). Something to do with the RTClib, I can serial.print with all my other code, that does not use
RTClib. I'm using the latest version RTClib 2.0.3
prints the time to serial. This worked for a short time and then I get the same problem. I've tried this on two
windows machines (win10). Something to do with the RTClib, I can serial.print with all my other code, that does not use
RTClib. I'm using the latest version RTClib 2.0.3
- eeyore124
- Posts: 12
- Joined: Fri Nov 09, 2012 3:21 pm
Re: DS3231 problems with serial.print
I traced it to the line that causes Serial.print to stop working. In the code below, the serial.print will not
work, if you comment out DateTime now = rtc.now(); then the Serial.print will work. Note I've tried setting
Serial.begin(57600); this is buad rate set in the example ds3231
work, if you comment out DateTime now = rtc.now(); then the Serial.print will work. Note I've tried setting
Serial.begin(57600); this is buad rate set in the example ds3231
Code: Select all
#include "RTClib.h"
RTC_DS3231 rtc;
// put your setup code here, to run once:
void setup() {
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
DateTime now = rtc.now();
Serial.println("Couldn't find RTC");
}
- eeyore124
- Posts: 12
- Joined: Fri Nov 09, 2012 3:21 pm
Re: DS3231 problems with serial.print
I switched to a different RTC library. Now using DS3232RTC and Serial.print() is working fine.
- Franklin97355
- Posts: 23912
- Joined: Mon Apr 21, 2008 2:33 pm
Re: DS3231 problems with serial.print
Thanks for posting. Where did you get the library? Interested.
- eeyore124
- Posts: 12
- Joined: Fri Nov 09, 2012 3:21 pm
Re: DS3231 problems with serial.print
downloaded it using the Library Manager DS3232RTC by Jack Christensen, latest version is v2.0.1
It's working great. I like the DS3231 RTC easy to use, now that I have a library that I can get Serial.print to work.
It's working great. I like the DS3231 RTC easy to use, now that I have a library that I can get Serial.print to work.
Please be positive and constructive with your questions and comments.