282Views4Replies

Author Options:

Arduino: using push button, Increase/decrease Delay time? Answered

Arduino: Is it possible to Increase/Decrease delay time using push button?

Discussions

Yes it is possible.. One way i can think of is,

1. You need two push button, one for increasing & one for decreasing

2. In the sketch declare two input variables for the push buttons

3. Then assign the input variable to the arduino pins

4. Now declare the Constant delay time to increase or decrease

4. Now write a code which increases/decreases the delay when button is pressed in the void loop. you can use if statement

5. Also store the increased or decreased delay time so that you don't loose your increased or decreased value once you switch off

hope this helps you !!!

I would wonder and it will be great helpful if you can please paste the code? I don't have much knowledge on writing the code...

You should study up on the examples provided with the arduino software installation and learn to code. With all due respect, the idea here is to support DIY, not DIFY.

Assign a pin to a button, then increment another variable (representing delay time) when it is pressed. You can choose to have it uptick once each press, or have it increment automatically as long as the button is held down. (same goes for decrement). If you can't translate that advise into useful code then you need to study up on programming.

Assign a default value for the delay_time of either zero or whatever default delay time your application requires.

Man... I already know theoretical explanations ..its much harder than that you said... anyway... I just did it.. with 4 push buttons and 4 DC motor and 2 stepper motor.... modifying some accelstep codes and DC motor L293D driver. But i don't post code here.. because this is DIY and not DCFH (do copy from here) :D