Answer the question
In order to leave comments, you need to log in
How to change the frequency value with the button on the Arduino?
There is a task: it is necessary to change the frequency value with one button. 4 frequency values are required. When you turn on the arduino, according to the standard, the frequency will be 1kHz, when you press the button - 2kHz, press it again - 4kHz, again - 8kHz, press it again, then return to the default value of 1kHz.
Please tell me how to implement?
Answer the question
In order to leave comments, you need to log in
On button click, increment variable with reset. 0-1-2-3-0-1-2-3 and so on, and then, depending on the value of the variable, use the case statement to set the desired generation frequency. Nothing complicated.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question