Arduino Programming Question How can I design a code in C or
Arduino Programming Question How can I design a code in C or C++ at Arduino IDE to control button and LED components with Arduino When I input times of I press the button in the IDE like 3 and I press the button with same times and the LED blink. Then, I input the times of pressing the button in the IDE like 3 and I can press the same times with input that I can turn off the LED. Thx
Solution
int led_pin = 7; void setup()
{
pinMode(led_pin, OUTPUT);
}
void loop() {
digitalWrite(led_pin, HIGH);
}
void loop() {
int button_state = digitalRead(button_pin);
digitalWrite(led_pin, button_state);
delay(3);
}
the first loop makes the led on and second makes halt and off if you press the button three times.
