input timer

Due to random noise on the input wires i'm trying to use a timer of over 100milis to filter out false signals but can't figure out how to formulate it for multiple inputs in the same code. I found the following, which works but only for 1 input:

   unsigned int timr=0;
  while (digitalRead(input1)==0) 
 {
    delay(10);
    timr++;
    Serial.println(timr);
 }
  if (timr>100) 
  {
     //do something

petronel: Due to random noise on the input wires i'm trying to use a timer of over 100milis to filter out false signals but can't figure out how to formulate it for multiple inputs in the same code. I found the following, which works but only for 1 input:

   unsigned int timr=0;
  while (digitalRead(input1)==0) 
 {
    delay(10);
    timr++;
    Serial.println(timr);
 }
  if (timr>100) 
  {
     //do something

you may be able to use Bounce2 library for this, which would ignore the noisy signal for a time period.

it is extensible to multiple instances.

petronel: Due to random noise on the input wires i'm trying to use a timer of over 100milis to filter out false signals but can't figure out how to formulate it for multiple inputs in the same code.

I'm not sure I understand exactly what you are trying to do but I think I would do it like this so that one interval deals with them all - and without using delay()

if (millis() - prevReadMillis >= 100) {
   prevReadMillis += 100;
   // read pin A
   // read pin B
   // read pin C
   // etc
}

See how millis() is used to manage timing without blocking in Several things at a time

...R