Hello everyone, I am trying to connect a 16x2 LCD screen using a lcm1602, along with a DS3132 to tell the time. I have both the devices connected to the scl and sda line, sharing it. Now, once the connection was finished I coded it in order to display the time on the LCD. When I uploaded the code, however, the display only sometimes showed some random symbols that would refresh and get pushed along the screen every second. The ds3231 seems to be working normally though.
Any thoughts on why this is? I have no Idea how to fix this. Thanks in advanced for the help.
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DS3231.h>
//initialze DS3231
DS3231 rtc(SDA, SCL);
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //0x3F is the address for the LCD
void setup() {
// put your setup code here, to run once:
//init. RTC object
lcd.begin(16, 2);
lcd.clear();
lcd.print("hello");
rtc.begin();
pinMode(2, INPUT_PULLUP);
pinMode(12, OUTPUT);
Serial.begin(9600);
lcd.clear();
delay(1000);
}
void loop(){
lcd.print(rtc.getTimeStr());
Serial.println(rtc.getTimeStr());
lcd.clear();
delay(1000);
}
I tried to put a simple "hello" during the setup function, but even that doesn't work. And when the "hello" is placed in the loop, all it does is flash parts of it faintly. Upon taking off the ds3231, the display works fine.