I have a problem with an RTC, because: it doesn't work correctly. When I try to read date or time, I see only see the characters "àààààààà" or or the program is blocked.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RTClib.h>
DS1307 rtc;
DateTime rtcTime;
void setup() {
//zainicjowanie generatora liczb losowych
randomSeed(A0);
Wire.begin();
rtc.begin();
}
void loop() {
rtcTime = rtc.now();
int mm = rtcTime.minute();
Serial.println(mm);
delay(500);
}
This function blockedblocks my program:
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
I can't find what is causing this problem. I use an Arduino UNOUno in the WOKWI Emulatoremulator.
String dateRTC(){
DateTime now = rtc.now();
String Day = "0" + String(now.day());
String Month = "0" + String(now.month());
String Year = String(now.year());
if(Day.length() == 3){
Day = Day.substring(1);
}
if(Month.length() == 3){
Month = Month.substring(1);
}
return Day+"-"+Month+"-"+Year;
}
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
I have a problem with RTC, because it doesn't work correctly. When I try read date or time, I see only characters "àààààààà" or or the program is blocked.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RTClib.h>
DS1307 rtc;
DateTime rtcTime;
void setup() {
//zainicjowanie generatora liczb losowych
randomSeed(A0);
Wire.begin();
rtc.begin();
}
void loop() {
rtcTime = rtc.now();
int mm = rtcTime.minute();
Serial.println(mm);
delay(500);
}
This function blocked my program:
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
I can't find what is causing this problem. I use Arduino UNO in WOKWI Emulator.
String dateRTC(){
DateTime now = rtc.now();
String Day = "0" + String(now.day());
String Month = "0" + String(now.month());
String Year = String(now.year());
if(Day.length() == 3){
Day = Day.substring(1);
}
if(Month.length() == 3){
Month = Month.substring(1);
}
return Day+"-"+Month+"-"+Year;
}
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
I have a problem with an RTC: it doesn't work correctly. When I try to read date or time, I only see the characters "àààààààà" or or the program is blocked.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RTClib.h>
DS1307 rtc;
DateTime rtcTime;
void setup() {
//zainicjowanie generatora liczb losowych
randomSeed(A0);
Wire.begin();
rtc.begin();
}
void loop() {
rtcTime = rtc.now();
int mm = rtcTime.minute();
Serial.println(mm);
delay(500);
}
This function blocks my program:
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
I can't find what is causing this problem. I use an Arduino Uno in the WOKWI emulator.
String dateRTC(){
DateTime now = rtc.now();
String Day = "0" + String(now.day());
String Month = "0" + String(now.month());
String Year = String(now.year());
if(Day.length() == 3){
Day = Day.substring(1);
}
if(Month.length() == 3){
Month = Month.substring(1);
}
return Day+"-"+Month+"-"+Year;
}
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
String dateRTC(){
DateTime now = rtc.now();
String Day = "0" + String(now.day());
String Month = "0" + String(now.month());
String Year = String(now.year());
if(Day.length() == 3){
Day = Day.substring(1);
}
if(Month.length() == 3){
Month = Month.substring(1);
}
return Day+"-"+Month+"-"+Year;
}
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
String dateRTC(){
DateTime now = rtc.now();
String Day = "0" + String(now.day());
String Month = "0" + String(now.month());
String Year = String(now.year());
if(Day.length() == 3){
Day = Day.substring(1);
}
if(Month.length() == 3){
Month = Month.substring(1);
}
return Day+"-"+Month+"-"+Year;
}
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
RTC DS1307 module not working
I have a problem with RTC, because it doesn't work correctly. When I try read date or time, I see only characters "àààààààà" or or the program is blocked.
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RTClib.h>
DS1307 rtc;
DateTime rtcTime;
void setup() {
//zainicjowanie generatora liczb losowych
randomSeed(A0);
Wire.begin();
rtc.begin();
}
void loop() {
rtcTime = rtc.now();
int mm = rtcTime.minute();
Serial.println(mm);
delay(500);
}
This function blocked my program:
String timeRTC(){
DateTime now = rtc.now();
String Hour = "0" + String(now.hour());
String Minutes = "0" + String(now.minute());
String Seconds = "0" + String(now.second());
if(Hour.length() == 3){
Hour = Hour.substring(1);
}
if(Minutes.length() == 3){
Minutes = Minutes.substring(1);
}
if(Seconds.length() == 3){
Seconds = Seconds.substring(1);
}
return Hour+":"+Minutes+":"+Seconds;
}
I can't find what is causing this problem. I use Arduino UNO in WOKWI Emulator.