Using an arduino push button and the following function void button_pushes(int c
ID: 2249960 • Letter: U
Question
Using an arduino push button and the following functionvoid button_pushes(int count) {
}
How do you code the function so that it will continue to loop until the button has been pushed to whatever count is equal to? Using an arduino push button and the following function
void button_pushes(int count) {
}
How do you code the function so that it will continue to loop until the button has been pushed to whatever count is equal to?
void button_pushes(int count) {
}
How do you code the function so that it will continue to loop until the button has been pushed to whatever count is equal to?
Explanation / Answer
//since its a function, it is assumed that setup and pin declaration is done.
void button_pushes (int count)
{
int button;
button = digitalRead (buttonpin); // assuming buttonpin is declared.
while (button == count)
{
// do nothing
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.