When I turn on the ATtiny, the OLED just blinks rapidly 10: 10: 10 instead of the time. Both the OLED and the RTC have been confirmed working on an Uno, and the correct time has been set on the RTC. I have tried many different variations of this code, but i cant seem to get this to work. Any help is appreciated.
// necessary libraries
#include <TinyWireM.h>
#include <Tiny4kOLED.h>
#include <TinyRTClib.h>
RTC_DS1307 rtc;
//varibles used to store current hour, minute, second
int hours;
int minutes;
int secs;
//string used to display current time.
String timestr = "";
void setup () {
//initiates the oled.
oled.begin();
oled.clear();
oled.on();
}
void loop () {
DateTime now = rtc.now();
//clears, sets font, positions cursot to top left on OLED
oled.clear();
oled.setFont(FONT8X16);
oled.setCursor(0, 0);
//puts current time in to the variables
hours = int(now.hour(), DEC);
minutes = int(now.minute(), DEC);
secs = int(now.second(), DEC);
//formats the string used for displaying the time
timestr = String(hours) + ": " + String(minutes) + ": " + String(secs);
//displays the time strimg
oled.print(timestr);
oled.switchFrame();
}