I am a new one!

Trying to program for a first time....
I need to program arduino when input 1 is low to send 1 pulse 500 mS to digital output (d13)
input 2 is low to send 2 pulse 500 mS to digital output (d13)
input 3 is low to send 3 pulse 500 mS to digital output (d13)
input 4 is low to send 4 pulse 500 mS to digital output (d13)
e.t.c

Thanks in advance this is my first project with arduino and like to understand how it works.....

What if input 1 and input 2 are low? You need to get clear how to deal with all combinations of inputs,
since you cannot both send 1 pulse and 2 pulses to D13 at the same time!

Perhaps input_1 has priority:

  if (digitalRead (input_1) == LOW) 
    output_pulses (1) ;
  else if (digitalRead (input_2) == LOW) 
    output_pulses (2) ;
  ....

I thought when some (d1,d2,d3,d4,d5 e.t.c) of these inputs came on low state (shortcut to the ground)
then to send impulses to the output.

Thanks for answer!

Hi,
Welcome to the forum.

When you output more than one pulse, how much time is there to be between one pulse stop and the next start?

Tom... :slight_smile:

I think it can be same pulse 200 mS just to drive coil relay.

id like to learn how it works and to understand programming....

Thank you Tom! :confused:

something like this?
void loop() {
// put your main code here, to run repeatedly:

pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(5, OUTPUT);
if (digitalRead (input_1) == LOW)
output_pulses (1) ;
else if (digitalRead (input_2) == LOW)
output_pulses (2) ;

}

or like this!

pinMode(2, INPUT_1);
pinMode(3, INPUT_2);
pinMode(4, INPUT_3);
pinMode(6, INPUT_4);
pinMode(7, INPUT_5);
pinMode(5, OUTPUT);
if (digitalRead (input_1) == LOW)
output_pulses (1) ;
else if (digitalRead (input_2) == LOW)
output_pulses (2) ;
else if (digitalRead (input_3) == LOW)
output_pulses (3) ;
else if (digitalRead (input_4) == LOW)
output_pulses (4) ;
else if (digitalRead (input_5) == LOW)
output_pulses (5) ;

when I push button on pin 2 i expect 1 times to send 500 ms pulse on output pin 13 and drive relay and stop.
when I push button on pin 3 i expect 2 times to send 500 ms pulse on output pin 13 and drive relay and stop.
when I push button on pin 4 i expect 3 times to send 500 ms pulse on output pin 13 and drive relay and stop.
when I push button on pin 5 i expect 5 times to send 500 ms pulse on output pin 13 and drive relay and stop.
any suggestions?