How can I connect external input and pass the information to GC?

Hi all,

I am setting up an octacopter drone for autonomous spraying mission and the copter has a motorized pump which controls the nozzle output from input pwm channel.
The copter was able to fly and spray water per waypoint mission however I still need to figure out when the tank goes empty during each flight mission.
So I attached a simple floating ball with hall effect sensor into the tank and connected the output to one of external gpios on the pixhawk.
The problem is that I don’t know how to utilize the port as an input and pass that info to a mavlink message.
I know there are example about connecting external sensor such as air speed or sonar data as adc input but not that I know about connecting TTL level output as input to pixhawk.
Do I have to make an app just for this? or any step by step method to configure the input?
Thanks,

Kyu

Hey,
I’m stuck with configuring the gpio pins , for using it , I’m quite new to PX4, can you make a tutorial for whatever you’ve done , atleast a doc.