'ds1307 running to slow on attiny85
Someone know why ATTiny85 connect to ds1307 crystal get time the refresh frequency to slow?
The new time value refresh change at 4 second. It running normal on arduino(UNO). ATTiny clock (internal 8 Mhz)
Thx.
#include <TinyWireM.h>
#include "TinyRTClib.h"
#include <Tiny4kOLED.h>
RTC_DS1307 rtc;
void setup() {
// put your setup code here, to run once:
oled.begin();
oled.clear();
oled.on();
oled.switchRenderFrame();
rtc.begin();
rtc.adjust(DateTime(2019, 3, 30, 15, 38, 0));
}
void loop(){
if (! rtc.isrunning()) {
return disconnectCrystal();
}
DateTime now = rtc.now();
oled.fill(0xFF);
oled.clear();
oled.switchFrame();
oled.setFont(FONT6X8);
oled.setCursor(32, 2);
..
oled.print(now.hour(), DEC);
oled.print(':');
oled.print(now.minute(), DEC);
oled.print(':');
oled.print(now.second(), DEC);
..
delay(1000);
}
Solution 1:[1]
Try using millis() instead of delay()
https://gist.github.com/kubilisr/eaf9d488e258a2175313fb38f6f80aa2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Shizuku Tsukishima |
