Detecting USB power supply



  • Hi,
    I am searching for guidance to trigger an WIFI action when the USB power supply has been detected.
    In my case the M5StickC is connected to my amplifier by USB Plug and as soon as the amplifier is switched on, the M5Stick shall send a wifi command enabling 2 WIFI plugs activating the rest of the stuff.

    I have some experience with Arduino, but not specifically with M5StickC. Please guide me...

    Stay safe and healthy!



  • see this file

    https://github.com/m5stack/M5StickC/blob/master/src/AXP192.h

    It is a part of M5StickC library for arduino

    You find it in a functions that help you to determine when power is connected to usb port, what voltage input and what current flow.

    You should interest this functions of axp192
    GetVinVoltage();
    GetVinCurrent();



  • Thanks for the hint. I got the script working now!