Hi,
for my project im trying to make a set of indicators, by basically pressing a button, and the led starts blinking, then pressing the button again, so they stop.
This is my first project with arduino and was wanting some help with coding.
This is what i have so far, but it only kind of works
Any help or guidance is much appreciated!
int button = 3;
int ledPin=13;
int state = 0;
int count = 0;
In loop() you increment count as long as the button pin is HIGH. I.e. count is constant only while the pin is LOW, and this is not what you want.
Furthermore make sure that the button pin is LOW when the button is not pressed. Buttons normally are connected from the pin to Gnd (LOW), and the pin is in HIGH state by use of a pullup resistor (to Vcc) or by mode INPUT_PULLUP.
Did you already try a simple example, showing how to debounce an button?