 long t6 = 0;
 
 int tempo = 0;
+float w = 0;
 
 void setup() {
   delay(1000);

    char c = keyboard.read();

    if (c == '1') {
      digitalWrite(zampaAS,HIGH);
      t1 = millis();
    } else if (c == '2') {
      digitalWrite(zampaAD,HIGH);
      t2 = millis();
    } else if (c == '3') {
      digitalWrite(zampaPS,HIGH);
      t3 = millis();
    } else if (c == '4') {
      digitalWrite(zampaPD,HIGH);
      t4 = millis();
    } else if (c == 'p') {
      digitalWrite(piede,HIGH);
      t5 = millis();
    } else if (c == 't') {
      digitalWrite(tamburo,HIGH);
      t6 = millis();
    }
    
    
  }

  else {
    if ((millis() - t1) > tempo) {
      digitalWrite(zampaAS,LOW);
    }
    if ((millis() - t2) > tempo) {
      digitalWrite(zampaAD,LOW);
    }
    if ((millis() - t3) > tempo) {
      digitalWrite(zampaPS,LOW);
    }
    if ((millis() - t4) > tempo) {
      digitalWrite(zampaPD,LOW);
    }
    if ((millis() - t5) > tempo) {
      digitalWrite(piede,LOW);

    }
  }
}

void galoppo(float v) {
  bool fine=false;
  long ii = millis();
  while (!fine) {
    digitalWrite(zampaPS,HIGH);
    if ((millis() - ii) > (300*v) {
      digitalWrite(zampaPS,LOW);
    } 

    if ((millis() - ii) > (75*v)) {
      digitalWrite(zampaPD,HIGH);
    }
    if ((millis() - ii) > (375*v)) {
      digitalWrite(zampaPD,LOW);
    }

    if ((millis() - ii) > (150*v)) {
      digitalWrite(zampaAS,HIGH);
    }
    if ((millis() - ii) > (450*v)) {
      digitalWrite(zampaAS,HIGH);
    }

    if ((millis() - ii) > (225*v)) {
      digitalWrite(zampaAD,HIGH);
    }
    if ((millis() - ii) > (525*v)) {
      digitalWrite(zampaAD,HIGH);
    }

    

    digitalWrite(zampaAD,HIGH);
  }
}
