Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    How do I get main.py to run when the WiPy board boots?

    Scheduled Pinned Locked Moved WiPy 2&3
    main.pywipybooterrorbug
    19 Posts 6 Posters 2.9k Views 7 Watching
    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.
    • robert-hhR Offline
      robert-hh @flatmop
      last edited by

      @flatmop I don't know whether you get an expansion board 2. AFAIK, they are not sold any more by PyCom. But distributors may have them still on stock.

      F 1 Reply Last reply Reply Quote 0
      • F Offline
        flatmop @robert-hh
        last edited by

        @robert-hh I ordered from RS Components.

        1 Reply Last reply Reply Quote 0
        • J Offline
          james.matthews
          last edited by

          boot.py tells the board what to do. If nothing is in boot then nothing will happen.

          Add this to boot.py:

          from machine import UART
          
          import machine
          import os
          
          uart = UART(0, baudrate=115200)
          os.dupterm(uart)
          
          machine.main('main.py')
          
          1 Reply Last reply Reply Quote 1
          • X Offline
            Xykon administrators
            last edited by

            You need to update the firmware first.

            The WiPy2 firmware that is flashed during production is very old and from what I remember there was indeed an issue with loading the main.py in that version.

            Christian Ehlers

            F 1 Reply Last reply Reply Quote 0
            • F Offline
              flatmop
              last edited by

              @james-matthews Ok thanks, created a boot.py with this code in it, and it now runs my RGB program when the WiPy is reset. Success! I feel as though this is some sort of hack or workaround however, as nowhere in the "Getting Started" guide does it say that you need a boot.py for this, it suggests as though main.py should run anyway.

              robert-hhR 1 Reply Last reply Reply Quote 0
              • robert-hhR Offline
                robert-hh @flatmop
                last edited by

                @flatmop That is the expected behavior, which you should get after an update of the firmware.

                F 1 Reply Last reply Reply Quote 0
                • F Offline
                  flatmop @Xykon
                  last edited by

                  @xykon I updated the firmware to the latest version with the Expansion Board 2.0, but that did not help. It was only when I tried @james-matthews's suggestion that I got it to work, which seems strange. The "getting started" guide gives the impression that once uploaded to the board, main.py should run automatically without needing a boot.py.

                  danD 1 Reply Last reply Reply Quote 0
                  • F Offline
                    flatmop @robert-hh
                    last edited by

                    @robert-hh I see. Perhaps they should make this more obvious in the "Getting Started" guide.

                    1 Reply Last reply Reply Quote 0
                    • danD Offline
                      dan @flatmop
                      last edited by

                      Hi @flatmop,

                      That is the case, main.py runs automatically (just tried it)

                      T 1 Reply Last reply Reply Quote 0
                      • T Offline
                        timh @dan
                        last edited by

                        @dan Yep I have never put anything in boot.py, have always had main.py run without intervention.

                        1 Reply Last reply Reply Quote 0

                        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
                        • 1 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom