<?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[5V stops working m5stickc]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I have a few M5stickc's that I uploaded the added code, and after uploading it the 5V port stops giving voltage immediatly.<br />
What could be the issue? I am using sleep mode, BLE, and reading some IO's basically.<br />
This is the code:</p>
<p dir="auto">//#include &lt;M5StickC.h&gt;<br />
#include &lt;BLEDevice.h&gt;<br />
#include &lt;BLEServer.h&gt;<br />
#include &lt;BLEUtils.h&gt;<br />
#include &lt;BLE2902.h&gt;<br />
//<em><strong><strong><strong><strong><strong><strong><strong><strong><strong>STATE MACHINE</strong></strong></strong></strong></strong></strong></strong></strong></strong></em><br />
#define NONE 0<br />
#define LEFT_ACTIVE 1<br />
#define RIGHT_ACTIVE 2<br />
#define BOTH_ACTIVE 3<br />
#define TIME_BEFORE_SLEEP 10000<br />
#define TIME_BEFORE_SEND 2000<br />
RTC_DATA_ATTR int lastState = NONE;<br />
//#define BUTTON_PIN_BITMASK 0x4000001 //for pins 0,26<br />
#define BUTTON_PIN_BITMASK 0x300000000 //for pins 32,33<br />
int state = BOTH_ACTIVE;<br />
int leftStatus;<br />
int rightStatus;<br />
const int leftSidePin = 32;<br />
const int rightSidePin = 33;<br />
const int LED = 10;<br />
unsigned int pingTime = 0;<br />
//************<em><strong><strong><strong><strong><strong>END STATE MACHINE</strong></strong></strong></strong></strong></em></p>
<p dir="auto">//<em><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>BLE</strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em>****<br />
BLEServer* pServer = NULL;<br />
BLECharacteristic* pCharacteristic = NULL;<br />
bool deviceConnected = false;<br />
bool firstConnection = false;</p>
<p dir="auto">#define SERVICE_UUID        "801a272c-a57b-11ea-bb37-0242ac130002"<br />
#define CHARACTERISTIC_UUID "801a29a2-a57b-11ea-bb37-0242ac130002"</p>
<p dir="auto">class MyServerCallbacks: public BLEServerCallbacks {<br />
void onConnect(BLEServer* pServer) {<br />
deviceConnected = true;<br />
firstConnection = true;<br />
pingTime = millis();<br />
};</p>
<pre><code>void onDisconnect(BLEServer* pServer) {
  deviceConnected = false;
}
</code></pre>
<p dir="auto">};<br />
//<em><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong><strong>END BLE</strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></strong></em></p>
<p dir="auto">void setup()<br />
{<br />
setupPins();</p>
<p dir="auto">startBLEServer();</p>
<p dir="auto">//wakingUp();</p>
<p dir="auto">//startSleep();<br />
}</p>
<p dir="auto">void loop()<br />
{<br />
refreshStatus();<br />
if (deviceConnected){<br />
if (firstConnection) {<br />
firstConnection = false;<br />
delay(300);<br />
pCharacteristic-&gt;setValue(state);<br />
pCharacteristic-&gt;notify();<br />
}<br />
else if (millis() - pingTime &gt; 5000) {<br />
pingTime = millis();<br />
pCharacteristic-&gt;setValue(state);<br />
pCharacteristic-&gt;notify();<br />
if ( state == NONE ) {<br />
delay(300);<br />
startSleep();<br />
}<br />
}<br />
}<br />
}</p>
<p dir="auto">void startSleep() {<br />
gpio_hold_en(GPIO_NUM_32);<br />
gpio_hold_en(GPIO_NUM_33);<br />
gpio_deep_sleep_hold_en();<br />
Serial.println("Active high will wake me up");<br />
esp_sleep_enable_ext1_wakeup(BUTTON_PIN_BITMASK,ESP_EXT1_WAKEUP_ANY_HIGH);<br />
esp_deep_sleep_start();</p>
<p dir="auto">Serial.println("This will never be printed");<br />
}</p>
<p dir="auto">void wakingUp(){<br />
esp_sleep_wakeup_cause_t wakeup_reason;</p>
<p dir="auto">wakeup_reason = esp_sleep_get_wakeup_cause();</p>
<p dir="auto">switch(wakeup_reason)<br />
{<br />
case ESP_SLEEP_WAKEUP_EXT0 : Serial.println("Wakeup caused by external signal using RTC_IO"); break;<br />
case ESP_SLEEP_WAKEUP_EXT1 : Serial.println("Wakeup caused by external signal using RTC_CNTL"); break;<br />
case ESP_SLEEP_WAKEUP_TIMER : Serial.println("Wakeup caused by timer"); break;<br />
case ESP_SLEEP_WAKEUP_TOUCHPAD : Serial.println("Wakeup caused by touchpad"); break;<br />
case ESP_SLEEP_WAKEUP_ULP : Serial.println("Wakeup caused by ULP program"); break;<br />
default : Serial.printf("Wakeup was not caused by deep sleep: %d\n",wakeup_reason); break;<br />
}</p>
<p dir="auto">refreshStatus();</p>
<p dir="auto">}</p>
<p dir="auto">void refreshStatus() {</p>
<p dir="auto">readInputs();</p>
<p dir="auto">getState();</p>
<p dir="auto">reportStatus();</p>
<p dir="auto">}</p>
<p dir="auto">void reportStatus() {<br />
if (state == NONE) {<br />
if (lastState == RIGHT_ACTIVE) {<br />
Serial.println("closed right side");<br />
}<br />
else if (lastState == LEFT_ACTIVE) {<br />
Serial.println("closed left side");<br />
}<br />
else {<br />
Serial.println("error - shouldn't be here L95");<br />
}<br />
}<br />
else if (state == RIGHT_ACTIVE) {<br />
Serial.println("Right side active");<br />
}<br />
else if (state == LEFT_ACTIVE) {<br />
Serial.println("Left side active");<br />
}<br />
else if (state == BOTH_ACTIVE) {<br />
Serial.println("Both active");<br />
}<br />
prints();<br />
lastState = state;<br />
}</p>
<p dir="auto">void readInputs() {<br />
leftStatus = digitalRead(leftSidePin);<br />
rightStatus = digitalRead(rightSidePin);<br />
}</p>
<p dir="auto">void getState() {<br />
if (!leftStatus &amp;&amp; !rightStatus) {<br />
state = NONE;<br />
}<br />
else if (!leftStatus &amp;&amp; rightStatus) {<br />
state = RIGHT_ACTIVE;<br />
}<br />
else if (leftStatus &amp;&amp; !rightStatus) {<br />
state = LEFT_ACTIVE;<br />
}<br />
else {<br />
state = BOTH_ACTIVE; // default<br />
}<br />
Serial.printf("You are in state %d\n",state);<br />
}</p>
<p dir="auto">void prints() {<br />
Serial.printf("State: %d, Last state: %d, Left status: %d, Right status: %d,\n",state,lastState,leftStatus,rightStatus);<br />
}</p>
<p dir="auto">void startBLEServer(){<br />
BLEDevice::init("BLE");<br />
pServer = BLEDevice::createServer();<br />
pServer-&gt;setCallbacks(new MyServerCallbacks());<br />
BLEService *pService = pServer-&gt;createService(SERVICE_UUID);<br />
pCharacteristic = pService-&gt;createCharacteristic(<br />
CHARACTERISTIC_UUID,<br />
BLECharacteristic::PROPERTY_READ   |<br />
BLECharacteristic::PROPERTY_WRITE  |<br />
BLECharacteristic::PROPERTY_NOTIFY |<br />
BLECharacteristic::PROPERTY_INDICATE<br />
);</p>
<p dir="auto">pCharacteristic-&gt;addDescriptor(new BLE2902());<br />
pService-&gt;start();<br />
BLEAdvertising *pAdvertising = BLEDevice::getAdvertising();<br />
pAdvertising-&gt;addServiceUUID(SERVICE_UUID);<br />
pAdvertising-&gt;setScanResponse(false);<br />
pAdvertising-&gt;setMinPreferred(0x0);  // set value to 0x00 to not advertise this parameter<br />
BLEDevice::startAdvertising();<br />
Serial.println("Waiting a client connection to notify...");<br />
}</p>
<p dir="auto">void setupPins(){<br />
<a href="//M5.begin" target="_blank" rel="noopener noreferrer nofollow ugc">//M5.begin</a>();<br />
Serial.begin(115200);<br />
prints();<br />
pinMode(LED,OUTPUT);<br />
digitalWrite(LED,LOW);<br />
pinMode(leftSidePin, INPUT_PULLUP);<br />
pinMode(rightSidePin, INPUT_PULLUP);<br />
}</p>
]]></description><link>https://community.m5stack.com/topic/2083/5v-stops-working-m5stickc</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 23:22:53 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/2083.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 28 Jun 2020 06:41:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to 5V stops working m5stickc on Wed, 01 Jul 2020 07:42:32 GMT]]></title><description><![CDATA[<p dir="auto">just like him said.  don't comment the <code>M5.begin();</code></p>
]]></description><link>https://community.m5stack.com/post/9211</link><guid isPermaLink="true">https://community.m5stack.com/post/9211</guid><dc:creator><![CDATA[m5stack]]></dc:creator><pubDate>Wed, 01 Jul 2020 07:42:32 GMT</pubDate></item><item><title><![CDATA[Reply to 5V stops working m5stickc on Sun, 05 Jul 2020 07:14:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/os88" aria-label="Profile: os88">@<bdi>os88</bdi></a> said in <a href="/post/9175">5V stops working m5stickc</a>:</p>
<blockquote>
<p dir="auto">void setupPins(){<br />
<a href="//M5.begin" target="_blank" rel="noopener noreferrer nofollow ugc">//M5.begin</a>();<br />
Serial.begin(115200);<br />
prints();<br />
pinMode(LED,OUTPUT);<br />
digitalWrite(LED,LOW);<br />
pinMode(leftSidePin, INPUT_PULLUP);<br />
pinMode(rightSidePin, INPUT_PULLUP);<br />
}</p>
</blockquote>
<p dir="auto">Should be at the beginning of the code and uncomment M5Begin.</p>
]]></description><link>https://community.m5stack.com/post/9210</link><guid isPermaLink="true">https://community.m5stack.com/post/9210</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Sun, 05 Jul 2020 07:14:55 GMT</pubDate></item><item><title><![CDATA[Reply to 5V stops working m5stickc on Tue, 30 Jun 2020 20:21:28 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/os88" aria-label="Profile: os88">@<bdi>os88</bdi></a> said in <a href="/post/9175">5V stops working m5stickc</a>:</p>
<blockquote>
<p dir="auto">//#include &lt;M5StickC.h&gt;</p>
</blockquote>
<p dir="auto">I only had the problem, when i uploaded my code the StickC was on. If i turned it off, i was not able to turn it back on with the power button.</p>
<p dir="auto">Just like you i had commented out the m5stack.h code.</p>
<p dir="auto">//#include &lt;M5StickC.h&gt;</p>
<p dir="auto">Have you tried it when the code Is not uncommitted?</p>
]]></description><link>https://community.m5stack.com/post/9206</link><guid isPermaLink="true">https://community.m5stack.com/post/9206</guid><dc:creator><![CDATA[Pepsi]]></dc:creator><pubDate>Tue, 30 Jun 2020 20:21:28 GMT</pubDate></item><item><title><![CDATA[Reply to 5V stops working m5stickc on Tue, 30 Jun 2020 19:58:48 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/pepsi" aria-label="Profile: pepsi">@<bdi>pepsi</bdi></a> Both sides don't work</p>
]]></description><link>https://community.m5stack.com/post/9203</link><guid isPermaLink="true">https://community.m5stack.com/post/9203</guid><dc:creator><![CDATA[OS88]]></dc:creator><pubDate>Tue, 30 Jun 2020 19:58:48 GMT</pubDate></item><item><title><![CDATA[Reply to 5V stops working m5stickc on Tue, 30 Jun 2020 18:07:55 GMT]]></title><description><![CDATA[<p dir="auto">Is it the 5volt at the grove connector. Or the unit side?</p>
]]></description><link>https://community.m5stack.com/post/9202</link><guid isPermaLink="true">https://community.m5stack.com/post/9202</guid><dc:creator><![CDATA[Pepsi]]></dc:creator><pubDate>Tue, 30 Jun 2020 18:07:55 GMT</pubDate></item><item><title><![CDATA[Reply to 5V stops working m5stickc on Mon, 29 Jun 2020 08:12:33 GMT]]></title><description><![CDATA[<p dir="auto">Hi,<br />
Thanks for the reply. Is there a way to reset AXP to its initial values?</p>
]]></description><link>https://community.m5stack.com/post/9191</link><guid isPermaLink="true">https://community.m5stack.com/post/9191</guid><dc:creator><![CDATA[OS88]]></dc:creator><pubDate>Mon, 29 Jun 2020 08:12:33 GMT</pubDate></item><item><title><![CDATA[Reply to 5V stops working m5stickc on Mon, 29 Jun 2020 06:45:33 GMT]]></title><description><![CDATA[<p dir="auto">you could check your code does have operation for AXP192. usually esp32 sleep don't affect the AXP192 output.</p>
]]></description><link>https://community.m5stack.com/post/9189</link><guid isPermaLink="true">https://community.m5stack.com/post/9189</guid><dc:creator><![CDATA[m5stack]]></dc:creator><pubDate>Mon, 29 Jun 2020 06:45:33 GMT</pubDate></item></channel></rss>