question about having a short press and longer press for the same button

Hello,

I got some questions to my Sketch.

int LEDrot = 3; //Farbe: rot
int LEDweiss = 4; //Farbe: weiss
int LEDrw = 5; //Farben: rot und weiß
int LEDrechts = 6; //Farbe: gruen auf der rechten Seite
int LEDlinks = 7; //Farbe: gruen auf der linken Seite

int Tasterrw = 11; //Taster für rot und weiß
int TasterRechts = 9; //Taster für rot
int TasterRechts2 = 12; //Taster für gruenr
int TasterLinks = 10; //Taser für weiss
int TasterLinks2 = 13; //Taster für gruenl

int Tasterstatusrw = 1;                 //Tasterstatusrw´s Maximalwert ist 1
int Tasterstatusr = 1;                  //Tasterstatusr´s Maximalwert ist 1
int Tasterstatusw = 1;                  //Tasterstatusw´s Maximalwert ist 1

int Tasterstatusaltrw = 1;              //Tasterstatusaltrw´s Maximalwert ist 1
int Tasterstatusaltr = 1;               //Tasterstatusaltr´s Maximalwert ist 1
int Tasterstatusaltw = 1;               //Tasterstatusaltw´s Maximalwert ist 1

int Zaehlerrw = 0;                      //Zaehlerrw Startwert ist 0
int Zaehlerr = 0;                       //Zaehlerr Startwert ist 0
int Zaehlerw = 0;                       //Zaehlerw Startwert ist 0

int blinken = 500;                      //500 steht für 0,5 Sekunden
int Minutetest = 6000;

#define INPUT_TYPE INPUT_PULLUP
#define ENTPRELLZEIT 5
boolean rechtsBlinken = true;
boolean linksBlinken = true;


const uint32_t prellIntervall = 10, kurzerIntervall = 250, langerIntervall = 750;
uint32_t aktMillis, prellMillis, ausgangMillis, aktMillis2, prellMillis2, ausgangMillis2;
bool aktTaster, altTaster, ausgangStatus, aktTaster2, altTaster2, ausgangStatus2;



void weisseLEDlang(){
  aktMillis2 = millis();

  altTaster2 = aktTaster2;
  if (aktMillis2 - prellMillis2 >= langerIntervall){
    prellMillis2 = aktMillis2;
    aktTaster2 = digitalRead(TasterLinks);
  }
  if (altTaster2 && !aktTaster2){
    if (ausgangStatus2){
      ausgangStatus2 = LOW;
      digitalWrite(LEDweiss, LOW);
    }
    else{
      ausgangMillis2 = aktMillis2;
      ausgangStatus2 = HIGH;
      digitalWrite(LEDweiss, HIGH);
    }
  }
}

void weisseLEDkurz(){
  aktMillis = millis();

  altTaster = aktTaster;
  if (aktMillis - prellMillis >= prellIntervall){
    prellMillis = aktMillis;
    aktTaster = digitalRead(TasterLinks);
  }
  if (altTaster && !aktTaster){
    if (ausgangStatus){
      ausgangStatus = LOW;
      digitalWrite(LEDweiss, LOW);
    }
    else{
      ausgangMillis = aktMillis;
      ausgangStatus = HIGH;
      digitalWrite(LEDweiss, HIGH);
    }
  }
  if (ausgangStatus && (aktMillis - ausgangMillis >= kurzerIntervall)){
    digitalWrite(LEDweiss, LOW);
    ausgangStatus = LOW;
  }
}

void blinkEingabe()
{
  static unsigned long lastMillis = 0;
  static boolean altTasteL = false;
  static boolean altTasteR = false;
  if (millis() - lastMillis < ENTPRELLZEIT) return;
  lastMillis = millis();
  boolean neuTasteL = digitalRead (TasterLinks2);
  boolean neuTasteR = digitalRead (TasterRechts2);
  if (INPUT_TYPE == INPUT_PULLUP)
  {
    neuTasteL =! neuTasteL;
    neuTasteR =! neuTasteR;
  }
  if (neuTasteL == HIGH && altTasteL == LOW)
  {
    linksBlinken =! linksBlinken;
  }
  if (neuTasteR == HIGH && altTasteR == LOW)
  {
    rechtsBlinken =! rechtsBlinken;
  }

  
  altTasteL = neuTasteL;
  altTasteR = neuTasteR;
}

void blinkAusgabe(){
  static unsigned long lastMillis = 0;
  static boolean onTakt = false;
  static unsigned long diffMillis = 0;
  unsigned long nowMillis = millis();
  diffMillis += nowMillis - lastMillis;
  if (diffMillis >= blinken){
   diffMillis = 0;
   onTakt=!onTakt;
   
      if (onTakt && linksBlinken){
        digitalWrite(LEDlinks, HIGH);
        }
      else {
        digitalWrite(LEDlinks, LOW);
        }
      if (onTakt && rechtsBlinken){
        digitalWrite(LEDrechts, HIGH);
        }
      else{ 
        digitalWrite(LEDrechts, LOW);
        }

   Serial.print(digitalRead(LEDlinks));
   Serial.print(digitalRead(LEDrechts));
   Serial.println();
  }
    lastMillis = nowMillis;
}

void setup() {
  // Setup
    Serial.begin (9600);
    pinMode (LEDrw, OUTPUT);            //LED rot und weiß output
    pinMode (LEDrot, OUTPUT);
    pinMode (LEDrechts, OUTPUT);        //LED gruen(gelb) rechts output
    pinMode (LEDweiss, OUTPUT);
    pinMode (LEDlinks, OUTPUT);         //LED gruen(gelb) links output
    pinMode (Tasterrw, INPUT);          //Taster für rot und weiß input
    pinMode (TasterRechts, INPUT);
    pinMode (TasterLinks, INPUT);
    pinMode (TasterRechts2, INPUT_TYPE);           //Taster für gruen(gelb) rechts input
    //digitalWrite (Tasterr, HIGH);       //Benötigter Status des rechten Tasters
    pinMode (TasterLinks2, INPUT_TYPE);           //Taster für gruen(gelb) links input
    //digitalWrite (Tasterl, HIGH);       //Benötigter Status des linken Tasters
    
    digitalWrite (LEDrw, LOW);          //Start-Status für rote und weiße LED
    //digitalWrite (LEDgruenr, LOW);      //Start-Status für gruen(gelb) rechts
    //digitalWrite (LEDgruenl, LOW);      //Start-Status für gruen(gelb) links
  }

void loop(){
  
  blinkAusgabe();
  blinkEingabe();
  weisseLEDkurz();
  weisseLEDlang();
  
    //Rote und Weiße LED Startbedingung
    Tasterstatusrw = digitalRead (Tasterrw);       //Von welchem Tasterstatus der Status gelesen wird

  if (Tasterstatusaltrw != Tasterstatusrw)         //Trifft nur zu wenn Tasterstatusaltrw ungleich Tasterstatusrw ist
  {   
    if (Tasterstatusrw == HIGH)                    //Trifft nur zu wenn Tasterstatusrw HIGH ist
    {
      if (Zaehlerrw == 1)                           //Wenn Zaehlerrw gleich 1 ist, also 1 mal betätigt ist
      { 
        Zaehlerrw = 0;                              //dann soll er sich beim weiteren betätigen auf 0 setzen
      }
      else
      { 
        Zaehlerrw++;                                //Sonst wird weiter hoch gezählt
      }
    }
  }
    
      //Rote und Weiße LED Schaltbedingung
  Tasterstatusaltrw = Tasterstatusrw;

  if (Zaehlerrw == 1)                               //Wenn Zaehlerrw gleich 1 ist
  {
    digitalWrite (LEDrw, HIGH);                     //werden die LED rot und weiß leuchten
  }

  if (Zaehlerrw == 0)                               //Wenn Zaehlerrw gleich 0 ist
  {
    digitalWrite (LEDrw, LOW);                      //sollen die LEDs nicht leuchten
  }



//Rote LED
  Tasterstatusr = digitalRead (TasterRechts);        //Von welchem Tasterstatus der Status gelesen wird
    if (Tasterstatusr == HIGH) {                      
     digitalWrite(LEDrot, HIGH);
     }
    else{ 
     digitalWrite(LEDrot, LOW);                                
     }
}

Throughout my void blinkAusgabe , I would like to put some sort of shortbuttonpress and longbuttonpress. So if you press the button for a short time it should blink for 3 seconds, if you press it for a longer time ,like lets say 1 second, then it should blink continuely until I press the button again. Basically the same idea which I have for my voids weisseLEDlang and weisseLEDkurz just with blinking instead of glowing continuely.

noiasca:
crosspost:
https://forum.arduino.cc/index.php?topic=653535
question about having a short press and longer press for the same button - LEDs and Multiplexing - Arduino Forum
ask a moderator to delete one.
give a more meaningfull description than "Question to my sketch"
afterwards you might geht answer in ONE thread

ye I´m sorry for me it didn´t show my other post so I thought it got deleted.

First off use a variable that decides what your LED does. Set it by hand, that is just set the value in the code and test all states and make sure it is working.

Then he remaining problem is to detect your long and short presses. Make a note of the millis time when the button is FRIST pressed. That is if it is pressed this time round the loop and wasn’t pressed last time.
Then when the short time interval has passed and he button has not been released you can set the how to flash variable to the long flash state.

When the button is released check that the interval is less than the short press limit, and if so set the how to flash variable to the short flash state.