2 LED and button toggle

How would I make a project where there is 2 buttons and 2 LEDs and each button toggles to turn on or off each led??

There is a good sketch on this in the IDE examples.

Hmmm. Try this:

//Radio Buttons 22

const int redledPin = 11;   //LED Pin #
const int greenledPin = 13;
const int redbutton = 2;    //button Pin #
const int greenbutton = 3;

char redbuttonstate = 0;
char greenbuttonstate = 0;

unsigned long redbuttoncount = 0;  //button debounce timeruunsigned long greenbuttoncount = 0;
unsigned long greenbuttoncount = 0;

//"marker" choses which counter to check
// by Paul___B of Arduino Forum
boolean timeout(unsigned long *marker, unsigned long interval) {
  if (millis() - *marker >= interval) {
    *marker += interval;    //move on ready for next interval
    return true;
  }
  else return false;
}

//Deal with a button read; true if button pressed and debounce is a new event
//Uses reading of button input, debounce store, state store and debounce interval.
//by Paul___B of Arduino Forum
boolean buttondown(char button, unsigned long *marker, char *buttonstate, unsigned long interval) {
  switch (*buttonstate) {                                 //odd states if was presses, >= 2 if debounce in progress
    case 0: //button up so far,
      if (button == HIGH) return false;                     //nothing happening!
      else {
        *buttonstate = 2;                                   // record that is now pressed
        *marker = millis();                                 // note when was pressed
        return false;                                       //and move on
      }

    case 1:   //button down so far,
      if (button == LOW) return false;               // noting happening!
      *buttonstate = 3;                              //record that is now released
      *marker = millis();                            //note when was released
      return false;                                  // and move on

    case 2:                                        //button was up, now down.
      if (button == HIGH) {
        *buttonstate = 0;                          // jackpot! update the state
        return true;                              //because we have the desired event!
      }
      else
        return false;                                    //not done yet; just move on

    case 3: // button was down mow up
      if (button == LOW) {
        *buttonstate = 1;                               //no, not debounced; revert the state
        return false;                                   // false alarm!
      }
      else {
        if (millis() - *marker >= interval) {
          *buttonstate = 0;                             //debounced; update state
          return false;                                 // but not the event we want
        }
        else
          return false;                                   //not done yet; just move on
      }
    default:                                        //error; recover anyway
      {
        *buttonstate = 0;
        return false;                                  // definitly false!

      }
  }
}

void setup() {
  pinMode(redledPin, OUTPUT);
  pinMode(greenledPin, OUTPUT);
  pinMode(redbutton, INPUT);
  pinMode(greenbutton, INPUT);
  digitalWrite (redledPin, LOW);
  digitalWrite (greenledPin, LOW);

  pinMode(redbutton, INPUT);
  digitalWrite(redbutton, HIGH);      //enable pullup resistor

  pinMode(greenbutton, INPUT);
  digitalWrite(greenbutton, HIGH);    //enable pullup resistor
}

void loop() {
  // Toggle LED if button is debounced
  if (buttondown(digitalRead(redbutton), &redbuttoncount, &redbuttonstate, 10UL )) {
    if (digitalRead(redledPin))
      digitalWrite (redledPin, LOW); else
      digitalWrite (redledPin, HIGH);
  }

  // Toggle LED if button is debounced
  if (buttondown(digitalRead(greenbutton), &greenbuttoncount, &greenbuttonstate, 10UL )) {
    if (digitalRead(greenledPin))
      digitalWrite (greenledPin, LOW); else
      digitalWrite (greenledPin, HIGH);
  }
}

Note of course that buttons connect from button pins to ground. LEDs from LED pin with resistor to LED to ground.

Extensible to any number of buttons. :grinning: