Seeeduino Lorawan

Hi,



I am running the below code to check battery status and am getting unexpected.

I have purchased 2 more Seeeduino Lorawan boards and they are giving the same results.



I am using a data only usb cable. I have tried 14505 and 17505 batteries connected using the JST2 connector supplied with the Seeeduino. The voltage is calculated at ~0.28V

When I connect to the device using a data+power usb cable as well as the battery, I am getting results, the voltage is 4.3V



This is the output on my serial monitor with battery connected and USB data only



Can you please assist me here? This is the last part of my project I need to get functional before I can demo it to my boss and we can talk about pushing these devices out (potentially hundreds of them).



[cid:[email protected]]Hi,









// battey of Seeeduino LoRaWAN



const int pin_battery_status = A5;

const int pin_battery_voltage = A4;





void setup() {

SerialUSB.begin(115200);

pinMode(pin_battery_status, INPUT);

}



void loop() {

delay(1000);

int a = analogRead(pin_battery_voltage);

float v = a/1023.03.311.0; // there’s an 1M and 100k resistor divider

SerialUSB.print(v, 2);

SerialUSB.print(’ ');

SerialUSB.println(digitalRead(pin_battery_status));



delay(1000);

}