Could MicroPython run alongside or inside TinyCLR? Giving the ability of MicroPhython of calling functions and methods in TinyCLR. This would allow for easy customization of a device and Python scrips could easily be changed on demand.
A use case I would use it for is remote sensor monitoring/alarming. The logic for alerts, based on time of day or sensor readings, unique algorithms, would be defined and run in the Python script. When the alarm conditions are met Python calls functions in TinyCLR that push the information up to the cloud for further processing/alerts, etc. If the monitoring requirements change a new Python script could easily be pushed down to the device. TinyCLR would run all the critical software functions and maintaining the connections required for command and control. If the Python script were to go crazy and lock up TinyCLR could kill it and send an alert.
Here’s an alternative … how about a micro-kernel that runs WASM? Then you could run and debug C, C++, Rust, C#, F#, Go, Kotlin, Swift, D, and even Pascal? Who needs all the limitations of uPython when you have that?
Admittedly, you still need a PC, Mac, or Linux, because there would be no REPL on the chip but also, you can use a PC OR Mac OR Linux.
The topic was MicroPython and/or variants and possibility of .tinyCLR to run a script interpreter.
Assume script interpreter would run on its own thread.
script commands would be loaded in an object
object ref (pointer) passed from ‘user code’ to interpreter via a queue
interpreter could signal whatever using Thread WaitHandles or whatever mechanism.
No need for ‘Ladder Logic’ type of dev environment or such.
Script dev environment need be nothing more than notepad.
The Script engine, expecting properly formatted script, would just execute the script.
Perhaps this script engine would consume json…does not matter to me.
The json would qualify params such as:
waitHandle referenced callback or such: …again, the mechanics of all is whatever the specs say
…If you have consumed any manufactured product, one can bet the odds that Ladder Logic was used in the process.!
So I have re-read @skeller and @mhardy’s text a few times, and I understand the use case as : I need “some but not all of my program’s behavior to be dynamic code”. So, if uPython or TinyBASIC or Lua or WASM could run hosted within a TinyCLR C# program, is that sufficient or does the whole program need to be parsed at runtime?
I think there are uses for writing whole programs in interpreted (REPL) languages [uPython, TinyBasic, Lua] and for WASM (bytecode interpreter), but it sounds like you are looking for the ability to dynamically update a small piece of your code, not write an entire program that way, and your current solution was to home-bake a ladder-logic engine. Correct?