Hello everyone,
I succeed to compile micropython as static library on a stm32h7.
Now, I try to share variable between my C application and micropython interpreter like this :
- Create variable in micropyhton
- Do calculation on variable
- Get this variable on my C application
Which function can I call to realize this example ?
Thanks for any help ?
Share variable between C and Micropython
Re: Share variable between C and Micropython
Bit hard to answer without more concrete information; essentially in C every MicroPython variable is going to be of type mp_obj_t. But how to best get to them depends on what/how you want to use this. I.e. are you implementing a custom type in C which getts exposed via a module? Then look at examples/usercmodule for instance. Do you just need one variable? You could use mp_load_global() from runtime.h.