2 buttons to change boolean variable

Hi there. I am having a problem regarding boolean variables.

What it want to is that when the enter button is pressed it switches from false to true, and when esc button is pressed it switches from true to false.

But i can only make it work with using the enter pin and then use the NOT operator to change the state. I want to use both enter and esc.

I hope somebody can help me.

here is my code: the boolean mySet is initialised like this boolean mySet = false;

 if (buttonPushCounter == 0 && digitalRead(enterPin) == HIGH) 
       mydisp.setPrintPos(4, 0, _TEXT_);
    mydisp.print("Dashboard 1       "); 
    mydisp.setPrintPos(4, 1, _TEXT_);
    mydisp.print("                   ");
     mydisp.setPrintPos(4, 2, _TEXT_);
    mydisp.print("                 ");
    mydisp.setPrintPos(4, 3, _TEXT_);
       mydisp.print("              ");
     mydisp.setPrintPos(4, 4, _TEXT_);
       mydisp.print("              ");
     mySet = true; 

  if (digitalRead(escPin == HIGH))
  mySet = false;

Make sure that pushbuttoncounter always holds zero and you should be ok. It might help if you actually did something to find out what mySet actually holds. My guess is that it's already working. But I'm only guessing. This is why.

The pushbuttoncounter is not the problem. It is made for at menu on a large lcd screen. It varies between 0 and 6. But i will try to follow the value of mySet

I found the problem, it was actually right.

I just wrote it wrong.

changed if (digitalRead(escPin == HIGH)) to if (digitalRead(escPin) == HIGH)

Idiot mistake. Only took my 2 hours! :/

Since the return from digitalRead is 0 or 1 you could even use if(digitalRead(escPin)) It would have the same meaning and remove the chance of you putting that bracket in the wrong place in future :)