V
V
VadimTolk2019-11-17 15:04:47
Arduino
VadimTolk, 2019-11-17 15:04:47

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

1 answer(s)
A
Alexander Volkov, 2019-11-17
@a_volkov1987

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 question

Ask a Question

731 491 924 answers to any question