Foottracking with optical mouse sensors as keyboard output

hi,
sadly I have an idea but only rudimentary Knowledge how to do it.
I want to use an Arduino Leonardo as a converter between a mouse sensor (one on each Foot) as movement and an output to a keystroke.
basically to place the sensor on the Foot/Shoe and when moving in the treadmill over the carpet surface the Up-Down movement will be translated to a fast or slow keystroke like the W Key and S Key, maybe even if the switching between left and right foot sensor exceeds a certain speed the Running Key, like Shift Key is added.

I have good skills with the Hardware but only lower basic skills with programming.

the idea is to use the foot movement as a Forward-Backward (maybe at some point sideward) movement.
as soon as the foot is raised the sensor is disabled for that foot. the position for the direction of walking is part of the VR system and not part of this project. the controller itself will be wired over USB.

any help is highly appreciated
Thank you

when moving in the treadmill over the carpet surface the Up-Down movement

Take a look at your mouse. What, exactly, does it do when you move it up (off the desk) or down (onto the desk)?

If up and down mean something else to you, a picture is worth 1000 words.