GPIO with keyPressed()

Hello!

I use my Raspberry Pi with Processing and a GPIO push button. Every tests I made worked fine. But I need with this button something equivalent to the function keyPressed(). Is it possible?
Or must I map the GPIO button to a key keyboard?

Thanks for your help.

hi @Jerome
can you show ( just a little ) code how you read the GPIO push button,
and a example where you failed to save it to a variable like

boolean this_GPIO_push_button_is_pressed ;

there is a issue about that every push button input “flickers”
see a example from arduino what i mean and about how to deal with it.

https://www.arduino.cc/en/Tutorial/Debounce