Problem mit Tastern/Servo/Motor&Analog Input

Hy,

ich hab mich in den letzten Tagen mit einem Sketch befassen müssen der sowohl 4 Servos als auch 2 Motoren und 6 Taster an einem duemilanove zum laufen bringen soll.
Ziel ist es das ich Taster 1-6 drücken kann und dann die dementsprechenden Servos bzw. Motoren darauf reagieren.
Ich hatte mir das ganze folgendermaßen vorgestellt. 1x Taster drücken Servo fährt auf Position 1
2x Taster drücken der Servo fährt wieder auf die Ursprungsposition zurück.
Urspünglich hatte ich das ganze dann versucht mit buttoncount umzusetzen, bin dann aber schnell auf Probleme gestossen und hab daher nen anderen Ansatz versucht
Indem ich versuche auszulesen wie lange der jeweilige Taster gedrückt wird und dann den unterschiedlichen Zeitwerten die jeweiligen Ereignisse zugeordnet....

Hab auch nach langem hin und her und viel copy und paste, jetzt endlich nen ersten sketch zusammen und wollte nun erstmal fragen ob das so funktionieren könnte....
Bin da im moment noch skeptisch da ich das erste mal versuche taster über die analogen inputs abzufragen und weiss daher auch überhaupt nicht ob ich das so richtig angegangen bin oder es vielleicht ne viel einfachere lösung dafür gäbe...?

#include <Servo.h> 
const int buttonPin = 12;  //Iris
const int buttonPin2 = 13; //Musik
const int buttonPin3 = 14; //Tuer1
const int buttonPin4 = 15; //Tuer2
const int buttonPin5 = 16; //Tuer3
const int buttonPin6 = 17; //Tuer4

Servo sp1;	  // create servo object to control a servo
Servo sp2;
Servo sp3;
Servo sp4;

int buttonPushCounter = 0;   // counter for the number of button presses
int buttonState     = 0;  // current state of the button
int lastButtonState = 0;  // previous state of the button
int pos     = 0;  // variable to store the servo positions

int out1A = 7; // Motor A, Steuerleitung 1 - L293D, Pin 15
int out2A = 2; // Motor A, Steuerleitung 2 - L293D, Pin 10
int enableA = 5;   // Motor A, PWM-Pin - L293D, Pin 9

int out1B = 8; // Motor B, Steuerleitung 1 - L293D, Pin 7
int out2B = 4; // Motor B, Steuerleitung 2 - L293D, Pin 2
int enableB = 3;   // Motor B, PWM-Pin - L293D, Pin 1

int current; //Current state of the button (LOW is pressed b/c i'm using the pullup resistors
int count;   // How long the button was held (secs)
byte previous = HIGH;
byte previous2 = HIGH;
byte previous3 = HIGH;
byte previous4 = HIGH;
byte previous5 = HIGH;

unsigned long firstTime;  
unsigned long firstTime2;  
unsigned long firstTime3;  
unsigned long firstTime4;  
unsigned long firstTime5;  

int current2;
int count2;   
int current3; 
int count3;   
int current4;
int count4;   
int current5; 
int count5;   
int current6; 
int count6;   

void setup() {     
  Serial.begin(9600);
 sp1.attach(9);	
 sp2.attach(10);
 sp3.attach(11);
 sp4.attach(6);
 sp1.write(90); 
 sp2.write(0); 
 sp3.write(180);
 sp4.write(0);
 
 pinMode(buttonPin, INPUT); 
 pinMode(buttonPin2, INPUT); 
 pinMode(buttonPin3, INPUT); 
 pinMode(buttonPin4, INPUT); 
 pinMode(buttonPin5, INPUT); 
 pinMode(buttonPin6, INPUT); 
}

void loop() 
{
   current = digitalRead(buttonPin);              //Iris
     if (current == LOW && previous == HIGH && millis()- firstTime > 200){
    firstTime = millis();    // if the buttons becomes press remember the time 
  }
  if (current == LOW && ((millis() - firstTime) % 1000) < 20 && millis() - firstTime > 500){
    count++;                // and 1 to the counter
  }
  if (current == HIGH && previous == LOW && count >=3 && count < 6){
    digitalWrite(out1A, LOW);   // set pin 2 on L293D low
    digitalWrite(out2A, HIGH);  // set pin 7 on L293D high
    delay(1500) ;
       digitalWrite(out1A, LOW);   // set pin 2 on L293D low
    digitalWrite(out2A, LOW);  // set pin 7 on L293D high
    ;// When the button is released if the counter is between the
  }                          // two numbers (3-6 blinks or secs) run the program

  if (current == HIGH && previous == LOW && count >=0 && count < 3){
   
    digitalWrite(out1A, HIGH);  // set pin 2 on L293D high
    digitalWrite(out2A, LOW);   // set pin 7 on L293D low
delay(500); 
 digitalWrite(out1A, LOW);  // set pin 2 on L293D high
    digitalWrite(out2A, LOW);   // set pin 7 on L293D low
; //This is where you would put you differnt functions
  }                                // with diffent time parameters

  if (current == HIGH){ // reset the counter if the button is not pressed
    count = 0;
  }

  previous = current;
   
  buttonState = digitalRead(buttonPin2);                //Musik
                      
  // check if the pushbutton is pressed.
  // if it is, the buttonState is HIGH:
  if (buttonState == HIGH) {     
    // turn LED on:    
   digitalWrite(out1B, HIGH);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
delay(500);  
 digitalWrite(out1B, LOW);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
  } 
  else {
    // turn LED off:
   digitalWrite(out1B, LOW);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
    
    
    current2 = analogRead(buttonPin3);              //Tuer 1
     if (current2 == LOW && previous2 == HIGH && millis()- firstTime2 > 200){
    firstTime2 = millis();    // if the buttons becomes press remember the time 
  }

  if (current2 == LOW && ((millis() - firstTime2) % 1000) < 20 && millis() - firstTime2 > 500){
   
    count2++;                // and 1 to the counter
  }
  if (current2 == HIGH && previous2 == LOW && count2 >=3 && count2 < 6){
    
    sp1.write(180);	  // tell servo to go to position 'pos'
	
   digitalWrite(out1B, HIGH);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
delay(1500);
 digitalWrite(out1B, LOW);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);
       
    ;// When the button is released if the counter is between the
  }                          // two numbers (3-6 blinks or secs) run the program

  if (current2 == HIGH && previous2 == LOW && count2 >=0 && count2 < 3){
   
   sp1.write(0);	  // tell servo to go to position 'pos'
	   digitalWrite(out1B, HIGH);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
delay(1500);
 digitalWrite(out1B, LOW);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);
; //This is where you would put you differnt functions
  }                                // with diffent time parameters

  if (current2 == HIGH){ // reset the counter if the button is not pressed
    count2 = 0;
  }

  previous2 = current2;   
    
    
    
    
      current3 = analogRead(buttonPin4);              //Tuer 2
     if (current3 == LOW && previous3 == HIGH && millis()- firstTime3 > 200){
    firstTime3 = millis();    // if the buttons becomes press remember the time 
  }

  if (current3 == LOW && ((millis() - firstTime3) % 1000) < 20 && millis() - firstTime3 > 500){
   
    count3++;                // and 1 to the counter
  }
  if (current3 == HIGH && previous3 == LOW && count3 >=3 && count3 < 6){
    
    sp2.write(180);	  // tell servo to go to position 'pos'
	   digitalWrite(out1B, HIGH);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
delay(1500);
 digitalWrite(out1B, LOW);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);
       
    ;// When the button is released if the counter is between the
  }                          // two numbers (3-6 blinks or secs) run the program

  if (current3 == HIGH && previous3 == LOW && count3 >=0 && count3 < 3){
   
   sp2.write(0);	  // tell servo to go to position 'pos'
	   digitalWrite(out1B, HIGH);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);   // set pin 7 on L293D low
delay(1500);
 digitalWrite(out1B, LOW);  // set pin 2 on L293D high
    digitalWrite(out2B, LOW);
; //This is where you would put you differnt functions
  }                                // with diffent time parameters

  if (current3 == HIGH){ // reset the counter if the button is not pressed
    count3 = 0;
  }

  previous3 = current3; 
    
        ...