Hi, so I am trying to change the delay time value of an LED from the push of a button but I got a problem.
The time does not change.
So, I would appreciate any help because I'm still a beginner at arduino.
Hello,
Can you be more precise about your objective.
Maybe we can help you even more?
Is LED blinking with a variable invterval time you want to change with the 2 buttons?
Best regards,
Johi.
Reading the buttons inside the LED ON/OFF "if" block, you would be able to read the buttons state only in the exact moment the LED is being turned ON or OFF.
Also, I would write the LED state to the pin inside that "if" block. No need continuously update the LED after the change.
And, like UKHeliBob already said, use the equal sign to update the interval variable.
This code snipe can be used to build the timer for debouncing and button polling function.
Or you may merge the debouncing and button polling function.
Anyway the project i was planning to do was finished and the code only used millis() for a button system.(which i later cleared off after findng a button library.).
Anyway the project i was planning to do was finished and the code only used millis() for a button system.(which i later cleared off after findng a button library.).Thanks for your help.