This is a different type of RTC than a DS3231. This might cause problems too.
In porgramming you have to be very precise. Sometimes a single missing character can change the codes behaviour dramatically. Same for using components.
yesterday another user had problems with an I2C-Display.
One thing to do is to check if the I2C-Bus is working at all with a test-sketch that just scans all I2C-adresss.
Here is a modificated version of this I2C-scanner-sketch that prints out more information
upload this sketch to your Arduino Nano
a.) with all devices connected
b.) with only the display connected
c.) with no device at all connected
and then post the results as code-sections
// --------------------------------------
// i2c_scanner
//
// Version 6, November 27, 2015.
// Added waiting for the Leonardo serial communication.
// This sketch tests the standard 7-bit addresses
// Devices with higher bit address might not be seen properly.
//
#include <Wire.h>
void setup() {
Wire.begin();
Serial.begin(115200);
//Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor
Serial.println("\n I2C Scanner");
}
void loop() {
byte error, address;
int nDevices;
Serial.println("Scanning...");
nDevices = 0;
for(address = 1; address < 127; address++ ) {
// The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if
// a device did acknowledge to the address.
Wire.beginTransmission(address);
error = Wire.endTransmission();
Serial.print("Wire.beginTransmission(");
Serial.print(address,HEX);
Serial.print(") result=");
Serial.println(error);
if (error == 0) {
Serial.print("I2C device found at address 0x");
if (address < 16)
Serial.print("0");
Serial.print(address,HEX);
Serial.println(" !");
nDevices++;
}
else if (error == 4) {
Serial.print("Unknown error at address 0x");
if (address < 16)
Serial.print("0");
Serial.println(address,HEX);
}
}
if (nDevices == 0)
Serial.println("No I2C devices found\n");
else
Serial.println("done\n");
delay(5000); // wait 5 seconds for next scan
}
Finally solved my issue. I bought really crappy RTC modules where the board was not grounded. After reading reviews on the product, several buyers mentioned that you had to create a jumper from the ground to C2. Once I made a temp jumper, the screen came to life and the code worked. All this of course after adding additional libraries as suggested by everyone here. Thanks for all the help!