#include <DS3231.h>
#include <LiquidCrystal_I2C.h>
const int joy_x = A0;
const int joy_y = A1;
const int joy_press = 5;
LiquidCrystal_I2C lcd(0x27, 16, 2);
DS3231 rtc(SDA, SCL);
Time t;
int buzzer = 7;
int ir = 5;
int m = 1;
class mode
{
public :
static int mode1()
{
lcd.setCursor(0,1);
lcd.print("Time : ");
lcd.print(rtc.getTimeStr());
}
};
mode i;
void setup()
{
pinMode(joy_x, INPUT);
pinMode(joy_y, INPUT);
pinMode(joy_press, INPUT);
Serial.begin(9600);
lcd.begin();
lcd.backlight();
rtc.begin();
rtc.setTime(21, 52, 0);
}
void loop()
{
if (analogRead(joy_x) < 300)
{
m++;
if (m > 4)
{
m = 1;
}
}
i.mode1;
Serial.println(m);
delay(1000);
}
every run fine but the lcd doesn't display anything