Replies: 2 comments 2 replies
-
I do not think that makes sense, but perhaps I do not understand the scenario or problem you are out to solve. If you explain what type of 'Arduino project' you have in mind, it may help to understand what solution could fit. |
Beta Was this translation helpful? Give feedback.
-
I find the reason that throws "undefined reference to xxx_function" ,because as an object-oriented language, C + + supports function overloading, while C does not. The names of functions compiled in C + + in the symbol library are different from those in C. I use main.cpp and include C files , if i want to make it correct, i should use extern "C" ,here is the main.cpp (I delete the part of gc collect): #include <Arduino.h>
extern "C"{
#include "port/micropython_embed.h"
}
static const char *example_1 =
"print('hello world!', list(x + 1 for x in range(10)), end='eol\\n')";
static const char *example_2 =
"for i in range(10):\n"
" print('iter {:08}'.format(i))\n"
"\n"
"try:\n"
" 1//0\n"
"except Exception as er:\n"
" print('caught exception', repr(er))\n"
"\n"
"print('finish')\n"
;
void setup() {
mp_embed_init();
mp_embed_exec_str(example_1);
mp_embed_exec_str(example_2);
mp_embed_deinit();
}
void loop() {}
after i solve this problem,i met others problems but i solve them, so now I successfully embeded micropython in an Arduino project. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to embed micropython in an Arduino project.
I see the many works about this topic have been done in micropython/examples/embedding and micropython/ports/embed .
The example successfully embeds micropython in a standalone C application , but i stiil don't know how to embed it in an arduino project to esp32
Can any one give me any suggestions or someone has try this before?
really thanks
Beta Was this translation helpful? Give feedback.
All reactions