hi, so i wanted to make my 7-segment display show numbers from 0 to 9 by pressing a button. for the 1st press it goes on fine. but after i press it the second time, the variable recording number of button presses increases but the display doesnt change. need help pls.
Heres the code:
int outstart = 2;
int outend = 10;
You are doing a lot of digitalWrite( < pin > , HIGH ) equivalent statements but never doing a digitalWrite( < pin > , LOW )
At the end, if it gets that far, all the segments will be on forming the digit 8.
…also, when testing the button state, check for a change of state, not just if it’s pressed.
Most switches will ‘chatter’ or bounce several times, leading to odd count values.
Have a look at other seven segment examples to see ow they set/clear the digit segments using an array[] of pins to match the segments for each character.
delay() isn’t your friend… in this case, you can only press the button once a second at best.
Letters are free, you can name your variables more generously.