Hello,
I have a distance sensor attached to the bottom of my copter. Furthermore I have the great EZ GUI for Android, which communicates via bluetooth and displays the sensor values and aux channel values etc. of the MultiWii.
Now I want to read the distance value of the sensor and set it to one of the aux channels, so that I can monitor the value using EZ GUI.
So my question is: Where in the MultiWii code is an appropriate place to read the sensor value and (more importantly) which variable do I need to set to have the distance value show up in aux5?
Of course aux5 is not used otherwise because my remote control has 8 channels.
I hope you can help me.
Set value of aux channel
Re: Set value of aux channel
I found a solution.
To have the variable show up in the GUI as aux5, set the variable rcData[8]. But note that the value needs to be between 1000 and 2000. Because my distance sensor gives values between 10 and 80, I add 1000 to rcData[8] to have it displayed properly in the GUI.
I put the code to update the distance value in the main loop, which works. However, I'm not sure if it is wise to place it there. The code requires a single analogRead every tick, which takes about 100 microseconds (Arduino documentation). I don't think it is a problem to do this every tick, but it would be nice if some expert here could confirm this.
To have the variable show up in the GUI as aux5, set the variable rcData[8]. But note that the value needs to be between 1000 and 2000. Because my distance sensor gives values between 10 and 80, I add 1000 to rcData[8] to have it displayed properly in the GUI.
I put the code to update the distance value in the main loop, which works. However, I'm not sure if it is wise to place it there. The code requires a single analogRead every tick, which takes about 100 microseconds (Arduino documentation). I don't think it is a problem to do this every tick, but it would be nice if some expert here could confirm this.
Re: Set value of aux channel
I think use of AUX values as debug output is not a good practice. MultiWii have debug[0] - debug[3] variables for your purposes. This values, as I know, viewable in EZ-GUI.