const int led = 10; //LED pin on my big Cat Board const int btn = 8; //Btn pin on my big Cat Board int state = 0; //state variable for switch case void setup() { // put your setup code here, to run once: pinMode(btn, INPUT_PULLUP); //Register Button pin as INPUT_PULLUP attachInterrupt(digitalPinToInterrupt(btn), buttonPress, FALLING); //Attach interrupt to pin which trigger function everytime the signal is in FALLING state pinMode(led, OUTPUT); //Register LED as OUTPUT } void loop() { //Switch case to keep track of current mode (Four modes available) switch(state%4){ //Since state can get bigger than three, just take mod of state to get current mode case 0: //LED is permanently OFF digitalWrite(led, LOW); break; case 1: //LED is permanently ON digitalWrite(led, HIGH); break; case 2: //LED is blinking with an intervall of 100 between ON and OFF states digitalWrite(led, HIGH); delay(100); digitalWrite(led, LOW); delay(100); case 3: //Dynamic intervall => LED blinks faster and faster for (int i = 1000; i >= 0; i -= 25) { digitalWrite(led, LOW); delay(i); digitalWrite(led, HIGH); delay(i); } } } //Function gets called at button interrupt, adds +1 to the current state void buttonPress(){ state += 1; }