DC motor command with angle and gyro

Hello
I would like to order a DC engine based on:

  • different speeds depending on the incline (0 to 10 degrees nothing, 10 to 40 128 and 40 value 255) and reverse to reduce engine speed
  • speed and gradual deceleration of the engine
    and the most would be to combine with the speed of the gyroscope if movement - we advance according to the speed of the angle, if negative movement we slow down and if no movement is the engine shutdown.
    I've done several program tests but I can't find the right technique.
    Please, could you help me?
    some sample code could be nice
    Alain

Also here

Thread moved as requested.

I've done several program tests but I can't find the right technique.

Please post the code, using code tags, and links to the components. Explain what should happen and what happens instead.

Please see the "How to use the forum" post for advice on asking questions.