Why my class doesn't work

#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

Did you mean

i.mode1 ();

?

You promised the compiler that mode1 would return an int, but it doesn't.
Didn't this at least raise a warning?

1 Like

Thank you very much

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