buzzed
Newbie level 6
I have connected a button to the 8085 microcontrollers and I want that button to perform different functions when pressed again and again.
But now when I pressed it executes all the functions pressing only once.
But now when I pressed it executes all the functions pressing only once.
Code:
void switich_1(void)
{
count = 0;
if (modef == 1){ // button is pressed
if (count == 0) {
count++; // increment count
add(); // perform one function
} else if (count == 1) { // on second press
count++; // increment count
subtract(); // perform another function,
} else if (count == 2) { // on second press
count =0;
divide(); //perform another function
}
}
}