How can i save my own code to the apps section?
-
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.
Sorry for the noob question and thanks in advance.
My piece of code
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 < imu0.acceleration[0] < 0.5): if (0.5 < imu0.acceleration[1] < 1.5): lcd.setRotation(1) if (-0.5 > imu0.acceleration[0] > -1.5): if (0.5 > imu0.acceleration[1] > -0.5): lcd.setRotation(2) if (-0.5 < imu0.acceleration[0] < 0.5): if (-0.5 > imu0.acceleration[1] > -1.5): lcd.setRotation(3) if (1.5 > imu0.acceleration[0] > 0.5): if (-0.5 < imu0.acceleration[1] < 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)
-
If using uiflow, there is an option in settings to permanitly download programs written in micropython to the MStack or Stick
-
Wow no Idea how i couldn´t find that. Thank you very much