need help in arduino, on delay button.


Recently i face a problem on my elevator project.

when i press my button it show’s high but after i release it is low

how to delay my button as high for 5 sec ?


Start exploring endless computing possibilities with your own Raspberry Pi computer and accessories. Perfect for beginners and students.

i did try with this program, lets said


const int button = 2; //declare button in pin 2

const int motorup = 8;

const int motordown = 9;


void setup() {

pinMode (button,INPUT);

pinMode (motorup,OUTPUT);

pinMode (motordown,OUTPUT);




void loop(){

buttonState = digitalread(button);

if (buttonState == HIGH){





but the delay of 5 sec might effect my other program below, how to make the switch on only for 5 sec without interrupt the other program below?



Thanks in advance.





asked August 24, 2015

Your Answer