The below video contains a demo and a brief description of the build process:

If you would like to see a more detailed explanation to implement this, have a look at my blog post: https://ivthdimension.wordpress.com/portfolio/exercise-bike-hacked-into-a-wireless-gamepad/

You can find the code here: https://github.com/joshjomer/Exercisebike-to-a-Wireless-Gamepad-using-ESP32