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

    Interactive console with operational code

    Scheduled Pinned Locked Moved MicroPython
    3 Posts 3 Posters 35 Views 3 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.
    • N Offline
      netskink
      last edited by

      Hello

      I've worked with esp32 in C and there is a capability where you can add a console component to your esp32 C app.

      Its handy to interact with your code while its running. You create new commands and these commands can call functions in your firmware.

      On pycom if hit ctrl-c in my app, I can interact with the python interpeter to import files and then run them. However I can't interact with them afterwards. Is there a method similar to the C method for esp32 to get something similar? Perhaps its just as simple to periodically call get input and write my own console. Before I do that I was wondering something already exists. Any pointers would be grand.

      I'm particulary interested in this as I explore bluetooth on pycom.

      robert-hhR 1 Reply Last reply Reply Quote 0
      • G Offline
        Gijs
        last edited by

        Hi,
        Im not exactly sure what you mean, but it is possible to type python commands into the REPL window after clicking run. If I create a code that does:

        include time
        while(1):
            time.sleep(1)
        

        And then click run, the >>> dissappear, but it is still possible to execute python commands in the microcontrollers' spare time. Only struggle is when your device keeps printing in between.
        Gijs

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

          @netskink said in Interactive console with operational code:

          I've worked with esp32 in C and there is a capability where you can add a console component to your esp32 C app.

          Given that C is a compiled language, this is hard to understand for me. So I assume it's some kind of firmware/application package which is running in the device. Still, the ESP32 does not have a general purpose Operating System.
          If you want to have the Python console while an application code is running, you can start that application in a new thread and terminate the thread which started it. Then you will get the REPL prompt again. But this is not general multitasking, just a method to run several tasks at the same time.

          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