I tested the Battery_power.ino example code on the WiFi LoRa32 V2 board. It worked perfectly. However, when I copied most of the code to the target application to read CO2 sensor via IIC code, the battery voltage always show full scale (4095 reading from analogRead(37) instruction). Here are the questions regarding the example code:
-
In setup(),
…
adcAttachPin(13); -
In loop(),
…
uint16_t c = analogRead(37)XSMUL;
Is adcAttachPin(13) and analogRead(37) correct?
Any suggestion to resolve the battery voltage reading problem?
Peter