If else not working

Hi Everyone!

First of all I'm new here, so please forgive any mistakes I make.

I've been struggeling with my code for a few days now and the problem is that both the "if" and the "else if " loops happen, even though i dont want that.

Any Help is Appricated!

if (settingsMenuX == 0 && settingsMenuY == 0) {
      //ResetSelected
      if (settingsCursor = 0) {
        Serial.print(settingsCursor);
        Serial.print("\n");
        lcd.setCursor(0, 0);
        lcd.print("RESET");
        settingsCursor = 1;
      }
      else if (settingsCursor = 1) {
        Serial.print(settingsCursor);
        Serial.print("\n");
        lcd.setCursor(0, 0);
        lcd.print("     ");
        settingsCursor = 0;
      }

= is for assignment, == for comparison. In an if you want comparison.

Oh, I totally forgot about that, thanks a lot!

set File->Preferences->Compiler warnings to More

1 Like