Interactive console with operational code
-
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.
-
@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.
-
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