Custom function using Mission Planning

Hello everyone,
I’m fairly new to drones and the px4 system. I’m currently working on my senior project and decided to build an agriculture drone for autonomous pesticide spraying. We were able to build the drone successfully and fly it using QGroundControl mission planner. Our project uses a pixhawk v1 (cheap to buy) and F550 DJI wheel flame frame.

I was wondering if possible to insert a custom function like setting the pwm value of one of auxiliary outputs on the pixhawk flight controller. The plan is to attach a pesticide module sprayer to one of the auxiliary outputs and spraying in between two waypoints. I need some guidance or pointers to get it starting. Many thanks for your help.