sorry for this thread, posted by mistake, now m unable to remove it
do you have resistor connected to the grnd to not let the pin float as you have the vcc connected to the pin this means that it will give a HIGH when the button is pressed but without any resistor that is a pull down the pin maybe definitely floating thereby making the condition true! and the code works with the for loop() working till 90 and then things end till another time floating again occurs.
alternatively you can use a internal pullup which is the internal 20k resistor on the ATmega328ps GPIOs like follows:
pinMode(3, INPUT);// configuring the pins as an input
digitalWrite(3,HIGH); //activating the pullup
then you connect the tactile switch to the GnD and not vcc and this should work!
thanks a lot nishant for the replay... ![]()
I realized that mistake after posting this problem ![]()