Turn arcade monitor 90 degrees with keyboard or button press

Hi there

I dont normaly ask for help but am having a hard time.

Im looking for a sketch to simply turn a servo to 90 degrees with a keyboard press then back when the same key is pressed again. I plan to map this button to an arcade button on my mame cab so the monitor rotates. I could use an Arcade button wired straight to the arduino if this is easier. I could also use 2 seperate buttons, one for rotate then another to go back if this easier too.

The servo will be powered at all times. Ive had limited sucecess copying stuff from google and using Tera Term but this only works when Tera term is the active window and i need this to run in the background really.

I really have no programming skills so if someone could write me this sketch i would be eternally gratefull thanks.

See the StateChangeDetection example. You also need a flag telling the current rotation (90° yes/no), so that you know the servo position to go when a button change is detected.