-
|
I'm trying to read battery voltage from a voltage divider connected to pin 34 on an ESP32 (with a 30-pin breakout board). I'm also using I've put this in my madflight_config.h: but I'm just getting zeros. Actually I'm not even sure the gizmo is initialized because I'm still getting zeroes even if I hardcode something like The wiring should be fine - I have a small sketch to test all the sensors, and I can get the correct battery reading with code like: setup(){
analogSetPinAttenuation(PIN_BATTERY_VOLTAGE, ADC_11db);
analogSetWidth(12);
}
loop(){
int raw_value = analogRead(PIN_BATTERY_VOLTAGE);
float v_adc = (raw_value / 4095.0) * 3.3f;
float voltage = v_adc * CALIBRATION_FACTOR;
}
The digital sensors like IMU and BAR are working fine with minimal changes done to running the ESP32, I see: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
|
Strange... Did you try v2.0.2-DEV? I did a quick test with "helloworld.ino" on a ESP32 dev board and it works fine for me: |
Beta Was this translation helpful? Give feedback.
-
|
I'm actually using platformio.ini with BTW, I just sat down to try it now, and was very confused that a new helloworld project I made wouldn't find madflight headers while the old one worked fine, then I saw you made a "new directory tree" commit just an hour ago 😅 Gonna update my projects, and try again. |
Beta Was this translation helpful? Give feedback.
-
|
Ah! My bad, I wasn't calling |
Beta Was this translation helpful? Give feedback.
Ah! My bad, I wasn't calling
bat.update()🤦