// set pin numbers
const byte led1 = 13; // first led is pin 13
const byte led2 = 12; // second led is pin 12
const byte led3 = 11; // third led is pin 11
const byte pushbutton = 8; // pushbutton is pin 8
// variables
unsigned long ledstate = 0; // current state of output pin
byte buttonstate;
byte lastbuttonstate = LOW;
int  reading;
void setup()
{
  Serial.begin(9600);
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);
  pinMode(pushbutton, INPUT);

  digitalWrite(led1, LOW);
  digitalWrite(led2, LOW);
  digitalWrite(led3, LOW);
}
void loop()
{
  reading = digitalRead(pushbutton);
  Serial.println(ledstate);

  if (reading != lastbuttonstate)
  {
    buttonstate = reading;

      if (buttonstate == HIGH)
      { 
        ledstate ++;
        if (ledstate == 4){
          ledstate = 0;
        }
      }
  
        if (ledstate == 1){
        digitalWrite(led1, HIGH);
        }
        else digitalWrite(led1, LOW);
        
        if (ledstate == 2){
        digitalWrite(led2, HIGH);
        }
        else digitalWrite(led2, LOW);
        
        if (ledstate == 3){
        digitalWrite(led3, HIGH);
        }
        else digitalWrite(led3, LOW);
        

  lastbuttonstate = reading;
  }
}