I’m trying to map the analog pins in arduplane to the corresponding pin number. Does anyone know the pin number for the ADC pin here? Everything I can find in the docs and online suggests it should be 15, which works with my same setup on a Cube Black but not with the Cube Orange.
These?
From Hwdef file.
I hadn’t thought to check those! I’m interested in the ADC port next to the TELEM1 port. That file includes the following
# And the analog input for airspeed (rarely used these days).
PC5 PRESSURE_SENS ADC1 SCALE(2)
So now I have a point of reference for the pin. By going to libraries/AP_HAL_ChibiOS/hwded/scripts/STM32H743xx.py, I can see the virtual pin assignments for the processor
ADC1_map = {
# format is PIN : ADC1_CHAN
"PF11" : 2,
"PA6" : 3,
"PC4" : 4,
"PB1" : 5,
"PF12" : 6,
"PA7" : 7,
"PC5" : 8,
"PB0" : 9,
"PC0" : 10,
"PC1" : 11,
"PC2" : 12,
"PC3" : 13,
"PA2" : 14,
"PA3" : 15,
"PA0" : 16,
"PA1" : 17,
"PA4" : 18,
"PA5" : 19,
}
I tried pin 8, and it worked! Thanks for your help!!
Do you think you could share your code on getting input from the ADC in arduplane? I’m trying currently but I am a bit confused. I was trying something like this.
ChibiOS::AnalogSource adc_input(8);
float level = adc_input.read_latest();