How can I adjust the motor pwm with the pilot toggle key during flight?

Hello.
I’m a college student preparing for a thesis.

The topic of the paper is ‘A study on flight behavior in the event of motor abnormalities during flight’.

When the controller channel 7 toggle key is placed in high, I want to code the PWM of motor 4 to be fixed at 1300.

I am using the firmware of the Copter 4.0.4 version.

How do I code for this experiment?

Please help me… :frowning:

I’m fairly certain Lua scripting could offer a solution. There are fully featured frame types controlled almost solely via scripting.

For a graduate thesis, there is no reason to use such outdated firmware. Update to the latest stable release (4.3.3 as of now).

See:
https://ardupilot.org/copter/docs/common-lua-scripts.html

I’m watching Lua script YouTube ‘Yuri’s Homebrew & DIY’.
Could you tell me how to code the firmware as well?