Hello to all members,
I am currently working on ArduPlane 3.6.0 code in order to read an analog voltage across Pixhawk's virtual pin 15 (in ADC 6.6 Volt port). To do this, i followed the example provided in the AP_HAL -> AnalogIn.cpp to get the voltage average across this pin. Following this sketch, i had a few lines of code to the original ArduPlane v3.6.0.
The code lines that i added are the following:
- In file Plane.h, between lines 379 and 388 (between receiver RSSI and Graound Speed) i add this:
float tracao_value;
AP_HAL::AnalogSource* tracao_analog_source;
where "tracao_value" is the voltage value that i want to read across ADC 6.6V port.
- In file "ArduPlane.cpp" between lines 100 and 105 (at the bottom of the void Plane::setup) i add this:
tracao_analog_source = hal.analogin->channel(15);
- In file Sensors.cpp between lines 126 and 131 (inside read_battery loop) i add this:
tracao_value = tracao_analog_source->voltage_average();
I then compile the code using make on windows (px4 console) and the compilation process runs succesfully without compile erros. However, when i upload the firmware onto the Pixhawk, the main led initializes, blinks yellow and then stops blinking. Furthermore, i when try to connect to mavlink, it wont connect.
Could this problem be related to the pointer AP_HAL::AnalogSource?
Could anyone please help me.
Thanks so much in advance?
Replies
Thanks James.