<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Power Input]]></title><description><![CDATA[<p dir="auto">Hello everyone,</p>
<p dir="auto">I have some questions about powering the Core2 module:</p>
<ol>
<li>Currently, if the device is turned off and is connected by USB-C, it turns on. I would like to know if I put the 5V bus in input mode and feed it 5V the same thing happens.</li>
<li>I was wondering what is the best way to detect the 5V input turning off to turn off the Core2 since there is a battery and it could stay on. Any ideas?</li>
</ol>
<p dir="auto">Thanks very much for your help!<br />
Fábio Dias</p>
]]></description><link>https://community.m5stack.com/topic/4571/power-input</link><generator>RSS for Node</generator><lastBuildDate>Fri, 01 May 2026 07:13:37 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/4571.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 30 Aug 2022 09:45:31 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Power Input on Tue, 30 Aug 2022 11:08:52 GMT]]></title><description><![CDATA[<p dir="auto">So with a bit of research, I develop this simple code that makes exactly what I was asking here:</p>
<pre><code>#include &lt;M5Core2.h&gt;
#define DEVICE_TIMEOUT 120000
float Time_bat = 0;

void setup{
  M5.begin();
  M5.Axp.SetBusPowerMode(1);
}

void loop{
  M5.Lcd.drawString(("Battery: " + String(M5.Axp.GetBatteryLevel())), 0, 120, 2);
  if(!M5.Axp.isVBUS() &amp;&amp; !M5.Axp.isCharging()){
    M5.Lcd.drawString(String((millis() - Time_bat)/1000,0) + "         ", 1, 154, 1);
  }else{M5.Lcd.drawString("Feeded             ", 1, 154, 1);}

  if(!M5.Axp.isVBUS() &amp;&amp; !M5.Axp.isCharging()){
      if(Time_bat == 0){Time_bat = millis();}
      if((millis() - Time_bat) &gt; DEVICE_TIMEOUT){M5.shutdown();}
  }else{
    Time_bat = 0;
  } 
}
</code></pre>
<p dir="auto">Hope it helps someone!</p>
]]></description><link>https://community.m5stack.com/post/18500</link><guid isPermaLink="true">https://community.m5stack.com/post/18500</guid><dc:creator><![CDATA[bexybot]]></dc:creator><pubDate>Tue, 30 Aug 2022 11:08:52 GMT</pubDate></item></channel></rss>