Debounce Button?


i am using uniduino with an arduino. I am using several buttons, but i have the problem, that i read the input of the buttons in update()
so every cycle. If i do something like:
if (pin_save_value == 1) {

i get “Pressed” multiple times.
Is there a good way to prevent this from happening? Some kind of “standard” way to debounce buttons?

Thanks a lot!

bool wasPressedLastUpdate = false;
void update(){
if(pinsavevalue == 1){
wasPressedLastUpdate = true;
wasPressedLastUpdate = false;

There might still be some issued with additional events when you release the button. If there are, you might try to count the number of updates since the button has been last pressed so that your program ignores too rapid pressing and releasing.