const byte interruptPin = 18; int choice = 0; void setup() { pinMode(interruptPin, INPUT_PULLUP); attachInterrupt(digitalPinToInterrupt(interruptPin), change, FALLING); for(int i=2; i<7; i++) { pinMode(i,OUTPUT); } } void loop() { switch(choice) { case 1 : offall(); break; case 2 : intoout(); break; case 3 : outtoin(); break; case 4 : jitter(); break; default: break; } } void offall() { for(int i=2; i<6; i++) { digitalWrite(i,LOW); } } void intoout() { for(int i=2; i<7; i++) { digitalWrite(i,HIGH); delay(150); } for(int i=2; i<7; i++) { digitalWrite(i,LOW); delay(150); } } void outtoin() { for(int i=6; i>1; i--) { digitalWrite(i,HIGH); delay(150); } for(int i=6; i>1; i--) { digitalWrite(i,LOW); delay(150); } } void jitter() {int a = random(2,7); digitalWrite(a,HIGH); delay(150); digitalWrite(a,LOW); delay(250); digitalWrite(a,HIGH); delay(50); digitalWrite(a,LOW); delay(150); } void change() { if (choice < 4) { choice++; } else { choice =0; } }