Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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 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? 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

}

}