https://docs.arduino.cc/tutorials/mkr-wifi-1010/rtc-clock/
has anyone tried to adapt this to run on the MKRCarrier V1
I have commented out all but the RTCZero.h and changed all the display functions to carrier but just doesn't want to load!
#include <RTCZero.h>
//#include <SPI.h>
//#include <Wire.h>
//#include <Adafruit_GFX.h>
//#include <Adafruit_SSD1306.h>
#include <Arduino_MKRIoTCarrier.h>
MKRIoTCarrier carrier;
//#define SCREEN_WIDTH 128 // OLED display width, in pixels
//#define SCREEN_HEIGHT 32 // OLED display height, in pixels
//Display configuration
//#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
/* Create an rtc object */
RTCZero rtc;
/* Change these values to set the current initial time */
const byte seconds = 0;
const byte minutes = 0;
const byte hours = 14;
/* Change these values to set the current initial date */
const byte day = 1;
const byte month = 2;
const byte year = 24;
void setup()
{
Serial.begin(9600);
//Initialize the IoTSK carrier and output any errors in the serial monitor
CARRIER_CASE = false;
carrier.begin();
//if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x32
// Serial.println(F("SSD1306 allocation failed"));
//for (;;); // Don't proceed, loop forever
rtc.begin(); // initialize RTC
// Set the time
rtc.setHours(hours);
rtc.setMinutes(minutes);
rtc.setSeconds(seconds);
// Set the date
rtc.setDay(day);
rtc.setMonth(month);
rtc.setYear(year);
// you can use also
//rtc.setTime(hours, minutes, seconds);
//rtc.setDate(day, month, year);
}
void loop()
{
//carrier.display.clearDisplay(); //clears display
carrier.display.setTextColor(ST77XX_WHITE); //sets color to white
carrier.display.setTextSize(2); //sets text size to 2
carrier.display.setCursor(0, 0); //x, y starting coordinates
print2digits(rtc.getDay()); //retrieve day
carrier.display.print("/");
print2digits(rtc.getMonth()); //retrieve month
carrier.display.print("/");
print2digits(rtc.getYear()); //retrieve year
carrier.display.setCursor(0, 18); //change cursor to second row
print2digits(rtc.getHours()); //retrieve hours
carrier.display.print(":");
print2digits(rtc.getMinutes()); //retrieve minutes
carrier.display.print(":");
print2digits(rtc.getSeconds()); //retrieve seconds
//carrier.display.display(); //print to display
delay(10);
}
void print2digits(int number) {
if (number < 10) {
carrier.display.print("0"); // print a 0 before if the number is < than 10
}
carrier.display.print(number);
}