🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    How to acquire and upload demo app?

    Micropython
    4
    19
    25.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ajb2k3A
      ajb2k3 @jhfoo
      last edited by

      @jhfoo if the api screen is showing, you missed the menu.
      the stick can be an problem in the older firmware as the menu appeared and dissapeared to quick. the stick doesn't have the demo as the demo is only for the core but the menu is there.

      UIFlow, so easy an adult can learn it!
      If I don't know it, be patient!
      I've ether not learned it or am too drunk to remember it!
      Author of the WIP UIFlow Handbook!
      M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

      1 Reply Last reply Reply Quote 0
      • world101W
        world101
        last edited by world101

        @jhfoo
        On the m5stickC, hold down the A button immediately after boot/power-on to access the menu. Then you use the B and A buttons to navigate and select.

        J ajb2k3A 3 Replies Last reply Reply Quote 1
        • J
          jhfoo @world101
          last edited by

          @world101 It worked! Very cool. Let me play with this some more.

          1 Reply Last reply Reply Quote 0
          • ajb2k3A
            ajb2k3 @world101
            last edited by

            @world101 said in How to acquire and upload demo app?:

            @jhfoo
            On the m5stickC, hold down the A button immediately after boot/power-on to access the menu. Then you use the B and A buttons to navigate and select.

            Thanks mate, I could not remember the sequence.

            UIFlow, so easy an adult can learn it!
            If I don't know it, be patient!
            I've ether not learned it or am too drunk to remember it!
            Author of the WIP UIFlow Handbook!
            M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

            1 Reply Last reply Reply Quote 0
            • J
              jhfoo @world101
              last edited by

              @world101 I'm almost there with USB-mode control. I can switch to USB mode. Using Windows Visual Code (Pymakr extension) I am unable to get the >>> prompt. The only way I get the prompt is when the built-in 'test' app is run.

              So I wrote a simple hello world app and managed to run it on the M5StickC without first saving the file in the stick. Trying to write the file results in an error and failed.

              My question is: what apps are expected to work in USB mode (since Visual Code REPL doesn't work), and how can I manage the files inside?

              world101W 1 Reply Last reply Reply Quote 0
              • world101W
                world101 @jhfoo
                last edited by

                @jhfoo

                I'm on a Mac and I use the OSX Terminal and the screen utility to access the REPL. On Windows, you might need to use Putty or something similar. With the uiFlow firmware burned to your m5stickC you can access the REPL.

                screen /dev/tty.usbserial-514A6FFF41 115200

                Once I'm in the screen session, I press Ctrl+C a few times to get to the REPL prompt. In the output below, I'm pressing Ctrl+C after it says "start m5ucloud monitor":

                MPY: soft reboot
                I (683470) [TFTSPI]: attached display device, speed=8000000
                I (683470) [TFTSPI]: bus uses native pins: false
                [ M5 ] node id:d8a01d698f30, api key:6501754B
                start m5ucloud monitor
                
                Unhandled exception in thread started by <bound_method>
                Traceback (most recent call last):
                  File "flowlib/lib/time_ex.py", line 69, in timeCb
                KeyboardInterrupt: 
                Traceback (most recent call last):
                  File "flow_usb.py", line 28, in <module>
                  File "flowlib/m5ucloud.py", line 45, in run
                  File "flowlib/lib/time_ex.py", line 69, in timeCb
                KeyboardInterrupt: 
                MicroPython v1.11-321-gac7da0a70-dirty on 2020-02-25; ESP32 module with ESP32
                Type "help()" for more information.
                >>> 
                >>> 
                >>> import os
                >>> os.listdir()
                ['image_app', 'flow_usb.py', 'config.json', 'main.py', 'res', 'boot.py', 'img', 'config.py', 'flow.py', 'blocks', 'apps', 'debug.py']
                >>> 
                >>> f = open('main.py')
                >>> f.read()
                'from m5stack import *\nfrom m5ui import *\nfrom uiflow import *\n\nsetScreenColor(0x111111)\n\nlabel1 = M5TextBox(24, 70, "TEST", lcd.FONT_Default,0xFFFFFF, rotate=0)'
                >>> 
                >>> f.close()
                >>> 
                >>> 
                

                In the above example, I open the main.py file (which is the 'test' app I think you are referring to) and read it to the REPL output. You can use other text editors to create your MicroPython programs and upload them to the m5stickC using ampy or another utility. Just save the file as main.py, upload it to the m5stickC and it will run after boot.py.

                Here is a good resource to look through.

                1 Reply Last reply Reply Quote 0
                • J
                  jhfoo
                  last edited by

                  @world101 said in How to acquire and upload demo app?:

                  115200

                  I followed your tip and got the prompt now! My mistake (habit of ESP8266 days) was thinking 9600 is a safe speed, which apparently isn't. Also didn't know about Ctrl-C until you mentioned it.

                  What do you use to transfer files both ways?

                  world101W 1 Reply Last reply Reply Quote 0
                  • world101W
                    world101 @jhfoo
                    last edited by

                    @jhfoo said in How to acquire and upload demo app?:

                    What do you use to transfer files both ways?

                    I use Adafruit ampy because it supports get and put to transfer files both ways. You could also try the Thonny IDE that @lukasmaximus mentioned in the other thread. I haven’t tried that yet.

                    I did try Mu IDE today with an m5stickC running the mainline MicroPython v1.12 firmware, but I wasn’t successful getting the REPL to work. It didn’t seem to detect the serial port connection to the m5stickC. However, Mu REPL did work for me with an M5Stack core running uiFlow v1.5.0 though.

                    J 1 Reply Last reply Reply Quote 0
                    • J
                      jhfoo @world101
                      last edited by

                      @world101 I got Visual Code (pymakr) to do some form of upload/ download. It's a big buggy; 'Upload current file only' feature crashes but 'upload project' is fine. The latter is not preferred because it uploads EVERYTHING in my project folder.

                      Will try ampy, thanks much!

                      1 Reply Last reply Reply Quote 0
                      • lukasmaximusL
                        lukasmaximus
                        last edited by

                        Upyloader, Mu and Thonny are all great tools with a nice GUI that you can use to transfer files to and from the flash of your device

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post