#define but1 5
#define but2 4
#define led1 9
#define led2 8

void setup() {
  // put your setup code here, to run once:
  pinMode(but1, INPUT_PULLUP);
  pinMode(but2, INPUT_PULLUP);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  Serial.begin(9600);

}

uint8_t ledstate1=0;
uint8_t ledstate2=0;
uint8_t flag1=1;
uint8_t flag2=1;

void loop() {
  // put your main code here, to run repeatedly:

  if(digitalRead(but1)==0 && flag1==1)
  {
      ledstate1!=ledstate1;
      ledstate2=0;
      flag1=0;
      Serial.println("a");
  }
  
  if(digitalRead(but1)==1 && flag1==0)
  {
      flag1=1;
  }


  if(digitalRead(but2)==0 && flag2==1)
  {
      ledstate2!=ledstate2;
      ledstate1=0;
      flag2=0;
  }

  if(digitalRead(but1)==2 && flag2==0)
  {
      flag2=1;
  }

  digitalWrite(led1, ledstate1);
  digitalWrite(led2, ledstate2);


}