I am new to Arduino because I wanted to replicate an electronic circuit I build using transistors and IC's.
I have in the past programed in BASIC but not for many many years.
Having viewed some tutorials online I wrote what I thought was a good bit of code (or sketch) only to find when I tried it on UnoArduSim (Simulator) it failed to run as I expected. I cannot see why and would appreciate any help in seeing what is incorect in my code which simply cycles through 4 LED's on a button press.
You do this each time through loop() so when the button is pressed buttonState will remain in its pressed state all the time that the button is pressed. The loop() function repeats thousands of times a second. Can you see how that might be a problem ?
You need to detect when the button becomes pressed rather than when it is pressed. Look at the StateChangeDetection example in the IDE to see how to do it.