RTC (Real Time Clock) with MKR WiFi 1010 and MKRIoTCarrier Display Display

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);
}

I wonder why did you put this into the "WiFi101 Shield" category?

I moved your topic to a more appropriate forum category @anon71499528.

In the future, please take the time to pick the forum category that best suits the subject of your question. There is an "About the _____ category" topic at the top of each category that explains its purpose.

Thanks in advance for your cooperation.

Can you please edit your post, select all code and click the <CODE/> button to apply code tags; next save your post.
This will make it easier to read, easier to copy and the forum software will display it correctly.

I'm not familiar with your boards; does that mean that you can't compile or upload? If so, the full error message (again use code tags, please) will help.

Sorry,this is my first post to the forum and I have no idea what you are talking about.
I grabbed the code from the tutorial which used the MKRWiFi1010 with an externally connected display and have tried to adapt the same ladder diagram for use with the MKRIoTCarrier...
I have been on a steep learning curve with the Explore IoT kit with the ultimate aim being to make a simple data logger BUT is has been difficult as Chiedozie Nwankwo will attest!
So please excuse my ignorance when I don't understand your instructions to just do this or that assuming I know what you are talking about...
Is there any reason why you can't just fix the post on my behalf?
Regards
Darryl

@anon71499528 it is your responsibility to make the effort to learn how to use the forum in a responsible and respectful manner.

Doing so will actually make it more likely for you to get assistance here with the minimum of friction. So it is in your own best interest.

Please click the link below to open the "How to get the best out of this forum" guide:

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966

Read that carefully and then fix your post. If there is anything in the guide you don't understand, you are welcome to make a topic with detailed questions. We will answer those for you.

Thankyou for the advice, I will see iff I can figure out how the button works and get back to you...

1 Like

Problem solved, all to do with which IDE was used to run the MKR Carrier

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.