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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login