How I know which power source is used in my RAK19001 base board (from sketch)?

Hi guys:

My developmet enviroment:

  • Base Board: RAK19001
  • Core Board: RAK11200
  • I using Arduino BSP in Windows 10.
  • I have battery and 5V from USB.

How I know which power source is used in my RAK19001 base board (from sketch)?

Regards

You don’t, there is no method I know about for the RAK11200 to know whether the source is battery or USB.

On the RAK4631 you can use

#include <nrfx_power.h>

nrfx_power_usb_state_t usb_status = nrfx_power_usbstatus_get();
if (usb_status != NRFX_POWER_USB_STATE_DISCONNECTED) // USB power detected

to check whether USB is connected and powered.

But the ESP32 has no built in USB, so you cannot do that.

Thanks @beegee !!!