<?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[How can i save my own code to the apps section?]]></title><description><![CDATA[<p dir="auto">I am very new to all this so i don´t really know much about it all. Altough i managed to program some code so that the Display turns when pressing button A, but as i am using USB Mode i cannot really save my code. It is only working aslong as i leave the M5Stack plugged in. When i plug it out i can´t acces the litlle programm.</p>
<p dir="auto">Sorry for the noob question and thanks in advance.</p>
<p dir="auto">My piece of code</p>
<pre><code class="language-from">from m5ui import *
from uiflow import *

import imu


setScreenColor(0x000000)

lcd.setRotation(3)

imu0 = imu.IMU()
label0 = M5TextBox(133, 6, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
label1 = M5TextBox(135, 107, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)
label2 = M5TextBox(131, 182, "Text", lcd.FONT_Default,0xFFFFFF, rotate=0)

R = None
b = None
a = None


def buttonA_wasPressed():
  global R, b, a
  if (-0.5 &lt; imu0.acceleration[0] &lt; 0.5):
    if (0.5 &lt; imu0.acceleration[1] &lt; 1.5):
      lcd.setRotation(1)
  if (-0.5 &gt; imu0.acceleration[0] &gt; -1.5):
    if (0.5 &gt; imu0.acceleration[1] &gt; -0.5):
      lcd.setRotation(2)
  if (-0.5 &lt; imu0.acceleration[0] &lt; 0.5):
    if (-0.5 &gt; imu0.acceleration[1] &gt; -1.5):
      lcd.setRotation(3)
  if (1.5 &gt; imu0.acceleration[0] &gt; 0.5):
    if (-0.5 &lt; imu0.acceleration[1] &lt; 0.5):
      lcd.setRotation(0)
btnA.wasPressed(buttonA_wasPressed)


while True:
  R = imu0.acceleration[0]
  label0.setText(str(R))
  b = imu0.acceleration[1]
  label1.setText(str(b))
  a = imu0.acceleration[2]
  label2.setText(str(a))
  wait(1)
  wait_ms(2)
</code></pre>
]]></description><link>https://community.m5stack.com/topic/1467/how-can-i-save-my-own-code-to-the-apps-section</link><generator>RSS for Node</generator><lastBuildDate>Sun, 10 May 2026 06:38:15 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/1467.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 13 Nov 2019 16:45:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How can i save my own code to the apps section? on Wed, 13 Nov 2019 18:43:46 GMT]]></title><description><![CDATA[<p dir="auto">Wow no Idea how i couldn´t find that. Thank you very much</p>
]]></description><link>https://community.m5stack.com/post/6369</link><guid isPermaLink="true">https://community.m5stack.com/post/6369</guid><dc:creator><![CDATA[Klingelfon]]></dc:creator><pubDate>Wed, 13 Nov 2019 18:43:46 GMT</pubDate></item><item><title><![CDATA[Reply to How can i save my own code to the apps section? on Wed, 13 Nov 2019 18:23:31 GMT]]></title><description><![CDATA[<p dir="auto">If using uiflow, there is an option in settings to permanitly download programs written in micropython to the MStack or Stick</p>
]]></description><link>https://community.m5stack.com/post/6368</link><guid isPermaLink="true">https://community.m5stack.com/post/6368</guid><dc:creator><![CDATA[ajb2k3]]></dc:creator><pubDate>Wed, 13 Nov 2019 18:23:31 GMT</pubDate></item></channel></rss>