{"id":774,"date":"2021-04-08T14:26:05","date_gmt":"2021-04-08T14:26:05","guid":{"rendered":"https:\/\/picockpit.com\/raspberry-pi\/?p=774"},"modified":"2023-11-23T02:13:08","modified_gmt":"2023-11-23T02:13:08","slug":"c-extension-for-micropython-on-raspberry-pi-pico","status":"publish","type":"post","link":"https:\/\/picockpit.com\/raspberry-pi\/es\/c-extension-for-micropython-on-raspberry-pi-pico\/","title":{"rendered":"Extensi\u00f3n C para MicroPython en Raspberry Pi Pico"},"content":{"rendered":"<p>Esta es una gu\u00eda sobre c\u00f3mo escribir y ejecutar una extensi\u00f3n b\u00e1sica de C para MicroPython en el Raspberry Pi Pico. Cubrir\u00e9 las razones para extender MicroPython, c\u00f3mo escribir el m\u00f3dulo de extensi\u00f3n, c\u00f3mo compilarlo y c\u00f3mo instalarlo en el Pico. Si quieres leer m\u00e1s sobre este tema, por favor consulta <a href=\"https:\/\/docs.micropython.org\/en\/latest\/develop\/extendingmicropython.html\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/docs.micropython.org\/en\/latest\/develop\/extendingmicropython.html<\/a><\/p>\n\n\n\n<h2>Introducci\u00f3n<\/h2>\n<h3>\u00bfPor qu\u00e9 ampliar MicroPython?<\/h3>\n<p>Puede haber m\u00faltiples razones por las que quiera extender MicroPython. Dado que es una versi\u00f3n recortada de Python, MicroPython no se desempe\u00f1a muy bien cuando se trata de tareas computacionalmente pesadas (similar a Python). Por otro lado, C es realmente adecuado para tales tareas. Una extensi\u00f3n C para Micropython le permite realizar esos c\u00e1lculos a trav\u00e9s del lenguaje C y utilizar los resultados en MicroPython. Esto puede acelerar algunos procesos en un orden de magnitudes.<\/p>\n<p>Una segunda raz\u00f3n podr\u00eda ser, que usted quiere interconectar alg\u00fan hardware que utiliza una API C desde dentro de MicroPython.&nbsp;<\/p>\n<h3>Tipos de extensiones de MicroPython C<\/h3>\n<p>Hay dos formas diferentes de extender MicroPython: m\u00f3dulos C externos y c\u00f3digo m\u00e1quina nativo en archivos .mpy.<\/p>\n<p>Para ejecutar un m\u00f3dulo C externo es necesario recompilarlo en el firmware de MicroPython. Este es un proceso bastante complicado, por lo que esta gu\u00eda se centrar\u00e1 en la segunda alternativa. Sin embargo, si est\u00e1 interesado en este enfoque, puede leer m\u00e1s sobre \u00e9l en estas p\u00e1ginas web:&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"https:\/\/docs.micropython.org\/en\/latest\/develop\/cmodules.html\" target=\"_blank\" rel=\"noopener\">https:\/\/docs.micropython.org\/en\/latest\/develop\/cmodules.html<\/a>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href=\"https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?t=300352\" target=\"_blank\" rel=\"noopener\">https:\/\/www.raspberrypi.org\/forums\/viewtopic.php?t=300352<\/a><\/p>\n<p>El .mpy es un archivo que almacena el c\u00f3digo m\u00e1quina nativo compilado y puede ser enlazado din\u00e1micamente. Esto lo hace mucho m\u00e1s flexible ya que no es necesario recompilar todo el firmware de MicroPython.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Escribir el m\u00f3dulo de ampliaci\u00f3n<\/h2>\n\n\n\n<p>Escribir el m\u00f3dulo de extensi\u00f3n es la parte m\u00e1s f\u00e1cil de extender MicroPython. Le mostrar\u00e9 c\u00f3mo hacerlo viendo un ejemplo sencillo. Para empezar, crearemos un nuevo directorio llamado <em>factfib<\/em>. Abre una nueva ventana de terminal, entra en el nuevo directorio y crea un nuevo archivo llamado <em>factfib.c<\/em>. Si has creado el directorio en una Raspberry Pi bajo Dekstop, el comando tiene el siguiente aspecto.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"cd ~\/Desktop\/factfibtouch factfib.c\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">cd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">~\/<\/span><span style=\"color: #D8DEE9\">Desktop<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">factfib<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">touch<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">c<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Abrir <span style=\"color: #008000;\"><span style=\"color: #000000;\"><span style=\"color: #008080;\"><em>factfib.c<\/em><\/span><span style=\"color: #000000;\"> en su editor de texto favorito e introduzca el siguiente c\u00f3digo:<\/span><\/span><\/span><\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"#include &quot;py\/dynruntime.hSTATIC mp_int_t factorial_helper(mp_int_t x) {   if (x < 1) {      return 1;   }   return x*factorial_helper(x-1);}STATIC mp_obj_t factorial(mp_obj_t x_obj) {   mp_int_t x = mp_obj_get_int(x_obj);   mp_int_t rslt = factorial_helper(x);   return rslt;}STATIC MP_DEFINE_CONST_FUN_OBJ_1(factorial_obj, factorial);STATIC mp_int_t fibonacci_helper(mp_int_t x) {   if (x <= 0) {      return 0;   }   else if (x == 1) {      return 1;   }   else {      return (fibonacci_helper(x-1) + fibonacci_helper(x-2));   }}STATIC mp_obj_t fibonacci(mp_obj_t x_obj) {   mp_int_t x = mp_obj_get_int(x_obj);   mp_int_t rslt = fibonacci_helper(x);   return mp_obj_new_int(rslt);}STATIC MP_DEFINE_CONST_FUN_OBJ_1(fibonacci_obj, fibonacci);mp_obj_t mpy_init(mp_obj_fun_bc_t *self, size_t n_args, size_t n_kw, mp_obj_t *args) {   MP_DYNRUNTIME_INIT_ENTRY   mp_store_global(MP_QSTR_factorial, MP_OBJ_FROM_PTR(&amp;factorial_obj));   mp_store_global(MP_QSTR_fibonacci, MP_OBJ_FROM_PTR(&amp;fibonacci_obj));   MP_DYNRUNTIME_INIT_EXIT}\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9FF\">#<\/span><span style=\"color: #D8DEE9\">include<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">&quot;<\/span><span style=\"color: #A3BE8C\">py\/dynruntime.<\/span><span style=\"color: #D8DEE9\">h<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">factorial_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&lt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #88C0D0\">factorial_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">factorial<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mp_obj_get_int<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">factorial_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_DEFINE_CONST_FUN_OBJ_1<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">factorial_obj<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factorial<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">&lt;=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">0<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">      <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> (<\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #81A1C1\">+<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #B48EAD\">2<\/span><span style=\"color: #D8DEE9FF\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mp_obj_get_int<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x_obj<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">mp_int_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">fibonacci_helper<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">x<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mp_obj_new_int<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">rslt<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">STATIC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_DEFINE_CONST_FUN_OBJ_1<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">fibonacci_obj<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">fibonacci<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">mpy_init<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">mp_obj_fun_bc_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9\">self<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">size_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">n_args<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">size_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">n_kw<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">mp_obj_t<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">*<\/span><span style=\"color: #D8DEE9\">args<\/span><span style=\"color: #D8DEE9FF\">) <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">MP_DYNRUNTIME_INIT_ENTRY<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #88C0D0\">mp_store_global<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">MP_QSTR_factorial<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_OBJ_FROM_PTR<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">&amp;<\/span><span style=\"color: #D8DEE9\">factorial_obj<\/span><span style=\"color: #D8DEE9FF\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #88C0D0\">mp_store_global<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">MP_QSTR_fibonacci<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">MP_OBJ_FROM_PTR<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #81A1C1\">&amp;<\/span><span style=\"color: #D8DEE9\">fibonacci_obj<\/span><span style=\"color: #D8DEE9FF\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">   <\/span><span style=\"color: #D8DEE9\">MP_DYNRUNTIME_INIT_EXIT<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Perm\u00edtame explicar el c\u00f3digo anterior: En MicroPython y Python, cada variable es un objeto. Por lo tanto en C las representamos como <em>mp_obj_t<\/em>. Pero un programa en C s\u00f3lo puede trabajar con variables de tipo C, por lo que necesitamos transformar el objeto en un tipo C. Esto se llama Marshalling y MicroPython proporciona funciones para extraer cualquier tipo C de un objeto.<\/p>\n\n\n\n<p>Esta p\u00e1gina web de Oliver Robson es realmente \u00fatil para Marshalling <a rel=\"noreferrer noopener\" href=\"https:\/\/mpy-c-gen.oliverrobson.tech\/\" target=\"_blank\">https:\/\/mpy-c-gen.oliverrobson.tech\/<\/a>. Adem\u00e1s, puede encontrar ejemplos de Marshalling en la documentaci\u00f3n de MicroPython <a rel=\"noreferrer noopener\" href=\"https:\/\/docs.micropython.org\/en\/latest\/develop\/natmod.html\" target=\"_blank\">https:\/\/docs.micropython.org\/en\/latest\/develop\/natmod.html<\/a>. Le aconsejo que lea este art\u00edculo si necesita m\u00e1s explicaciones.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Construir la extensi\u00f3n<\/h2>\n\n\n\n<p>Construimos la extensi\u00f3n en un archivo .mpy utilizando un Makefile. Pero primero tenemos que configurar algunas cosas. Aseg\u00farate de que tu terminal sigue abierta en el <em>factfib<\/em> directorio. A continuaci\u00f3n, clone el repositorio GitHub de MicroPython.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo apt-get install build-essential libreadline-dev libffi-dev git pkg-config gcc-arm-none-eabi libnewlib-arm-none-eabigit clone --recurse-submodules\u00a0https:\/\/github.com\/micropython\/micropython.gitpip3\u00a0install\u00a0'pyelftools&gt;=0.25'\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">apt<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">get<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">build<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">essential<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">libreadline<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">libffi<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">git<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">pkg<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">config<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">gcc<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">arm<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">none<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">eabi<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">libnewlib<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">arm<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">none<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">eabi<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">git<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">clone<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">--<\/span><span style=\"color: #D8DEE9\">recurse<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">submodules<\/span><span style=\"color: #D8DEE9FF\">\u00a0https<\/span><span style=\"color: #ECEFF4\">:<\/span><span style=\"color: #616E88\">\/\/github.com\/micropython\/micropython.git<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">pip3<\/span><span style=\"color: #D8DEE9FF\">\u00a0<\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\">\u00a0<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><span style=\"color: #A3BE8C\">pyelftools&gt;=0.25<\/span><span style=\"color: #ECEFF4\">&#39;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Estas instalaciones llevar\u00e1n un tiempo, si quieres ahorrar tiempo y sabes lo que est\u00e1s haciendo, s\u00f3lo tienes que clonar el directorio \/py y \/tools del repositorio de micropython y ponerlos dentro de un <em>micropython<\/em> dentro de la carpeta&nbsp;<em>factfib<\/em> (omita el segundo comando).<\/p>\n\n\n\n<p>Mientras se ejecuta la instalaci\u00f3n podemos aprovechar el tiempo para escribir el Makefile. Simplemente ejecuta<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"touch Makefile\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">touch<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">Makefile<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>y abra el archivo reci\u00e9n creado en un editor de texto.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"MPY_DIR = micropythonMOD = factfibSRC = factfib.cARCH = armv7minclude $(MPY_DIR)\/py\/dynruntime.mk\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">MPY_DIR<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">micropython<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">MOD<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">SRC<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">c<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">ARCH<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">armv7m<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">include<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">$<\/span><span style=\"color: #D8DEE9FF\">(<\/span><span style=\"color: #D8DEE9\">MPY_DIR<\/span><span style=\"color: #D8DEE9FF\">)<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">py<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">dynruntime<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">mk<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Habr\u00e1s notado que hemos puesto el <em>ARCO <\/em>variable a <em>armv7m<\/em> aunque el pico es <em>armv6m<\/em>. Tenemos que hacer esto porque el <em>armv6m<\/em> no es (en el momento en que estoy escribiendo este art\u00edculo) compatible con la arquitectura <em>dynruntime.mk<\/em> herramienta.<\/p>\n\n\n\n<p>Pero por suerte a\u00fan podemos compilar una extensi\u00f3n que funcione para el Pico. S\u00f3lo tenemos que modificar el archivo <em>dynruntime.mk <\/em>que debe estar ubicado en <em>micropython\/py\/dynruntime.mk.&nbsp;<\/em>\u00c1brelo y bajo Configuraci\u00f3n de la arquitectura en armv7m encuentra la variable CFLAGS (deber\u00eda ser la l\u00ednea 64). Cambie&nbsp;<em>-mcpu=cortex-m3<\/em> a&nbsp;<em>-mcpu=cortex-m0<\/em> y guardar el archivo.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"86\" src=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange-300x86.png\" alt=\"cambiar -mcpu=cortex-m3 a -mcpu=cortex-m0\" class=\"wp-image-780\" style=\"width:648px;height:186px\" srcset=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange-300x86.png 300w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange-768x219.png 768w, https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/04\/dynruntimeChange.png 946w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/figure>\n<\/div>\n\n\n<p>Luego, cuando todo est\u00e9 instalado, ejecute<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"make\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">make<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>y el&nbsp;<em>factfib.mpy<\/em> se crear\u00e1 un archivo.<\/p>\n\n\n\n<h2>Instalar y probar la extensi\u00f3n<\/h2>\n\n\n\n<p>El \u00faltimo paso es instalar y probar. Para ello utilizamos el sistema de archivos que Micropython crea en la Raspberry Pi Pico. En primer lugar tenemos que flashear el Pico con el firmware MicroPython. la forma m\u00e1s f\u00e1cil de hacer esto es utilizar el IDE Thonny (preinstalado en Raspbian \/ Raspberry Pi OS).<\/p>\n\n\n\n<p>Si no est\u00e1 utilizando una Raspberry Pi para programar su Pico o si nunca ha utilizado MicroPython en el Pico, consulte la gu\u00eda de iniciaci\u00f3n a MicroPython de Raspberry Pi <a href=\"https:\/\/www.raspberrypi.org\/documentation\/rp2040\/getting-started\/#getting-started-with-micropython\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.raspberrypi.org\/documentation\/rp2040\/getting-started\/#getting-started-with-micropython<\/a><\/p>\n\n\n\n<p>Si usted est\u00e1 usando Windows debe revisar este blog Post sobre la Raspberry Pi Pico y MicroPython en Windows <a href=\"https:\/\/picockpit.com\/raspberry-pi\/raspberry-pi-pico-and-micropython-on-windows\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/picockpit.com\/raspberry-pi\/raspberry-pi-pico-and-micropython-on-windows\/<\/a><\/p>\n\n\n\n<p>Cierre Thonny despu\u00e9s de haber flasheado su Pico con el firmware de MicroPython e instale rshell. Usamos rshell para acceder al sistema de archivos desde la l\u00ednea de comandos.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo pip3 install rshellrshell --version\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">pip3<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">rshell<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">rshell<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">--<\/span><span style=\"color: #D8DEE9\">version<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Esto imprime la versi\u00f3n rhsell si todo est\u00e1 configurado correctamente. Luego desenchufa el pico y con\u00e9ctalo de nuevo (sin mantener el bot\u00f3n BOOTSEL) para asegurarte de que nada est\u00e1 intentando acceder al sistema de archivos. Ahora tenemos que ejecutar<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"rshell -p \/dev\/ttyACM0 --buffer-size 512cp factfib.mpy \/pyboard\/factfib.mpy\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">rshell<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">p<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">ttyACM0<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">--<\/span><span style=\"color: #D8DEE9\">buffer<\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">size<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">512<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9\">cp<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">mpy<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">pyboard<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #ECEFF4\">.<\/span><span style=\"color: #D8DEE9\">mpy<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Para probar la instalaci\u00f3n puede utilizar rshell o el IDE de Thonny para guardar su <em>.py<\/em> en el Pico, pero voy a demostrar c\u00f3mo utilizar el int\u00e9rprete MicroPython sobre el minicom.<\/p>\n\n\n\n<p>As\u00ed que primero pulse&nbsp;<em>Ctrl+c<\/em> para salir de rshell y luego instalar minicom a trav\u00e9s de<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"sudo apt install minicom\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">sudo<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">apt<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">install<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">minicom<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>ahora podemos acceder al REPL de Picos (bucle de lectura-evaluaci\u00f3n-impresi\u00f3n)<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"minicom -o -D \/dev\/ttyACM0\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #D8DEE9\">minicom<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">o<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">-<\/span><span style=\"color: #D8DEE9\">D<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">dev<\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #D8DEE9\">ttyACM0<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Los tres corchetes angulares de cierre &gt;&gt;&gt; indican que el int\u00e9rprete de MicroPython se est\u00e1 ejecutando. Ahora podemos importar nuestra extensi\u00f3n y trabajar con ella como de costumbre.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"><\/circle><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"><\/circle><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"><\/circle><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"&gt;&gt;&gt; import factfib as ff&gt;&gt;&gt; ff.factorial(5)&gt;&gt;&gt; 120&gt;&gt;&gt; ff.fibonacci(7)&gt;&gt;&gt; 13\" style=\"color:#d8dee9ff;display:none\" aria-label=\"Copia\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code data-no-translation=\"\"><span class=\"line\"><span style=\"color: #81A1C1\">&gt;&gt;&gt;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">import<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #D8DEE9\">factfib<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">as<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #8FBCBB\">ff<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; <\/span><span style=\"color: #8FBCBB\">ff<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">factorial<\/span><span style=\"color: #D8DEE9FF\">(5)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; 120<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; <\/span><span style=\"color: #8FBCBB\">ff<\/span><span style=\"color: #D8DEE9FF\">.<\/span><span style=\"color: #8FBCBB\">fibonacci<\/span><span style=\"color: #D8DEE9FF\">(7)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">&gt;&gt;&gt; 13<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>\u00a1Enhorabuena! \u00a1Ha creado su primera extensi\u00f3n MicroPython C para el Pico! El siguiente paso es aprender a escribir y compilar m\u00f3dulos m\u00e1s complejos. Una buena manera de empezar es probando c\u00f3mo funciona el Marshalling de listas y dicts (ver la p\u00e1gina web de Marshalling de arriba). <\/p>\n\n\n\n<p>Si tiene alguna pregunta sobre este post, no dude en escribir un comentario.<\/p>\n<div class=\"shariff shariff-align-center shariff-widget-align-left shariff-buttonstretch\"><ul class=\"shariff-buttons theme-white orientation-horizontal buttonsize-medium\"><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#595959\"><a href=\"https:\/\/twitter.com\/share?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fes%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F&text=C%20extension%20for%20MicroPython%20on%20Raspberry%20Pi%20Pico\" title=\"Compartir en X\" aria-label=\"Compartir en X\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#000; color:#000\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#000\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 24 24\"><path fill=\"#000\" d=\"M14.258 10.152L23.176 0h-2.113l-7.747 8.813L7.133 0H0l9.352 13.328L0 23.973h2.113l8.176-9.309 6.531 9.309h7.133zm-2.895 3.293l-.949-1.328L2.875 1.56h3.246l6.086 8.523.945 1.328 7.91 11.078h-3.246zm0 0\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#000\">compartir<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fes%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F\" title=\"Compartir en Facebook\" aria-label=\"Compartir en Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#3b5998\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#3b5998\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#3b5998\">compartir<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button telegram shariff-nocustomcolor\" style=\"background-color:#4084A6\"><a href=\"https:\/\/telegram.me\/share\/url?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fes%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F&text=C%20extension%20for%20MicroPython%20on%20Raspberry%20Pi%20Pico\" title=\"Compartir en Telegram\" aria-label=\"Compartir en Telegram\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0088cc; color:#0088cc\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#0088cc\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 32 32\"><path fill=\"#0088cc\" d=\"M30.8 6.5l-4.5 21.4c-.3 1.5-1.2 1.9-2.5 1.2L16.9 24l-3.3 3.2c-.4.4-.7.7-1.4.7l.5-7L25.5 9.2c.6-.5-.1-.8-.9-.3l-15.8 10L2 16.7c-1.5-.5-1.5-1.5.3-2.2L28.9 4.3c1.3-.5 2.3.3 1.9 2.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#0088cc\">compartir<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button reddit shariff-nocustomcolor\" style=\"background-color:#ff5700\"><a href=\"https:\/\/www.reddit.com\/submit?url=https%3A%2F%2Fpicockpit.com%2Fraspberry-pi%2Fes%2Fc-extension-for-micropython-on-raspberry-pi-pico%2F\" title=\"Compartir en Reddit\" aria-label=\"Compartir en Reddit\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#ff4500; color:#ff4500\" target=\"_blank\"><span class=\"shariff-icon\" style=\"fill:#ff4500\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewbox=\"0 0 512 512\"><path fill=\"#ff4500\" d=\"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z\"\/><\/svg><\/span><span class=\"shariff-text\" style=\"color:#ff4500\">compartir<\/span>&nbsp;<\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>Esta es una gu\u00eda sobre c\u00f3mo escribir y ejecutar una extensi\u00f3n b\u00e1sica de C para MicroPython en el Raspberry Pi Pico. Cubrir\u00e9 las razones para extender MicroPython, c\u00f3mo escribir el m\u00f3dulo de extensi\u00f3n, c\u00f3mo compilarlo y c\u00f3mo instalarlo en el Pico. Si quieres leer m\u00e1s sobre este tema,...<\/p>","protected":false},"author":3,"featured_media":679,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1193,10],"tags":[964,19,756,477,18,963,606,14,11,486,447,476,187,17],"class_list":["post-774","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","category-raspberry-pi-pico","tag-bash","tag-c","tag-c-c","tag-circuitpython","tag-extension","tag-fibonacci","tag-linux","tag-micropython","tag-pico","tag-project","tag-projects","tag-python","tag-raspberry-pi","tag-raspberrypi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>C extension for MicroPython on Raspberry Pi Pico | PiCockpit<\/title>\n<meta name=\"description\" content=\"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/picockpit.com\/raspberry-pi\/es\/c-extension-for-micropython-on-raspberry-pi-pico\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"C extension for MicroPython on Raspberry Pi Pico | PiCockpit\" \/>\n<meta property=\"og:description\" content=\"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/picockpit.com\/raspberry-pi\/es\/c-extension-for-micropython-on-raspberry-pi-pico\/\" \/>\n<meta property=\"og:site_name\" content=\"PiCockpit\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pi3gshop\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-08T14:26:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-23T02:13:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1600\" \/>\n\t<meta property=\"og:image:height\" content=\"1143\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nathan Busler\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@pi3g\" \/>\n<meta name=\"twitter:site\" content=\"@pi3g\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nathan Busler\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"},\"author\":{\"name\":\"Nathan Busler\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/e38fef75134e5e54175b2615a8c3eb47\"},\"headline\":\"C extension for MicroPython on Raspberry Pi Pico\",\"datePublished\":\"2021-04-08T14:26:05+00:00\",\"dateModified\":\"2023-11-23T02:13:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"},\"wordCount\":1089,\"commentCount\":8,\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"keywords\":[\"bash\",\"C\",\"c\\\/c++\",\"circuitpython\",\"extension\",\"fibonacci\",\"linux\",\"microPython\",\"Pico\",\"project\",\"Projects\",\"python\",\"Raspberry Pi\",\"RaspberryPi\"],\"articleSection\":[\"Python\",\"Raspberry Pi Pico\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\",\"name\":\"C extension for MicroPython on Raspberry Pi Pico | PiCockpit\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"datePublished\":\"2021-04-08T14:26:05+00:00\",\"dateModified\":\"2023-11-23T02:13:08+00:00\",\"description\":\"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#primaryimage\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2021\\\/01\\\/PICO-BOARD-TOP-WHITE.jpg\",\"width\":1600,\"height\":1143,\"caption\":\"raspberry pi pico\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/c-extension-for-micropython-on-raspberry-pi-pico\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/category\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"C extension for MicroPython on Raspberry Pi Pico\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#website\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"name\":\"PiCockpit\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#organization\",\"name\":\"PiCockpit.com\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"contentUrl\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/wp-content\\\/uploads\\\/2023\\\/07\\\/Screenshot-from-2023-07-24-15-01-24.png\",\"width\":1165,\"height\":283,\"caption\":\"PiCockpit.com\"},\"image\":{\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/pi3gshop\",\"https:\\\/\\\/x.com\\\/pi3g\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/#\\\/schema\\\/person\\\/e38fef75134e5e54175b2615a8c3eb47\",\"name\":\"Nathan Busler\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g\",\"caption\":\"Nathan Busler\"},\"sameAs\":[\"https:\\\/\\\/buyzero.de\"],\"url\":\"https:\\\/\\\/picockpit.com\\\/raspberry-pi\\\/es\\\/author\\\/nathan\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extensi\u00f3n C para MicroPython en Raspberry Pi Pico | PiCockpit","description":"Gu\u00eda sobre c\u00f3mo escribir y ejecutar una extensi\u00f3n de C para MicroPython en la Raspberry Pi Pico. Esta gu\u00eda es adecuada para principiantes y expertos.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/picockpit.com\/raspberry-pi\/es\/c-extension-for-micropython-on-raspberry-pi-pico\/","og_locale":"es_ES","og_type":"article","og_title":"C extension for MicroPython on Raspberry Pi Pico | PiCockpit","og_description":"Guide on how to write and run a C extension for MicroPython on the Raspberry Pi Pico. This guide is suited for beginners and experts.","og_url":"https:\/\/picockpit.com\/raspberry-pi\/es\/c-extension-for-micropython-on-raspberry-pi-pico\/","og_site_name":"PiCockpit","article_publisher":"https:\/\/www.facebook.com\/pi3gshop","article_published_time":"2021-04-08T14:26:05+00:00","article_modified_time":"2023-11-23T02:13:08+00:00","og_image":[{"width":1600,"height":1143,"url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","type":"image\/jpeg"}],"author":"Nathan Busler","twitter_card":"summary_large_image","twitter_creator":"@pi3g","twitter_site":"@pi3g","twitter_misc":{"Escrito por":"Nathan Busler","Tiempo de lectura":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#article","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"},"author":{"name":"Nathan Busler","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/e38fef75134e5e54175b2615a8c3eb47"},"headline":"C extension for MicroPython on Raspberry Pi Pico","datePublished":"2021-04-08T14:26:05+00:00","dateModified":"2023-11-23T02:13:08+00:00","mainEntityOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"},"wordCount":1089,"commentCount":8,"publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","keywords":["bash","C","c\/c++","circuitpython","extension","fibonacci","linux","microPython","Pico","project","Projects","python","Raspberry Pi","RaspberryPi"],"articleSection":["Python","Raspberry Pi Pico"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/","url":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/","name":"Extensi\u00f3n C para MicroPython en Raspberry Pi Pico | PiCockpit","isPartOf":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#website"},"primaryImageOfPage":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage"},"thumbnailUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","datePublished":"2021-04-08T14:26:05+00:00","dateModified":"2023-11-23T02:13:08+00:00","description":"Gu\u00eda sobre c\u00f3mo escribir y ejecutar una extensi\u00f3n de C para MicroPython en la Raspberry Pi Pico. Esta gu\u00eda es adecuada para principiantes y expertos.","breadcrumb":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#primaryimage","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2021\/01\/PICO-BOARD-TOP-WHITE.jpg","width":1600,"height":1143,"caption":"raspberry pi pico"},{"@type":"BreadcrumbList","@id":"https:\/\/picockpit.com\/raspberry-pi\/c-extension-for-micropython-on-raspberry-pi-pico\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/picockpit.com\/raspberry-pi\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/picockpit.com\/raspberry-pi\/category\/python\/"},{"@type":"ListItem","position":3,"name":"C extension for MicroPython on Raspberry Pi Pico"}]},{"@type":"WebSite","@id":"https:\/\/picockpit.com\/raspberry-pi\/#website","url":"https:\/\/picockpit.com\/raspberry-pi\/","name":"PiCockpit","description":"","publisher":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/picockpit.com\/raspberry-pi\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/picockpit.com\/raspberry-pi\/#organization","name":"PiCockpit.com","url":"https:\/\/picockpit.com\/raspberry-pi\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/","url":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","contentUrl":"https:\/\/picockpit.com\/raspberry-pi\/wp-content\/uploads\/2023\/07\/Screenshot-from-2023-07-24-15-01-24.png","width":1165,"height":283,"caption":"PiCockpit.com"},"image":{"@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pi3gshop","https:\/\/x.com\/pi3g"]},{"@type":"Person","@id":"https:\/\/picockpit.com\/raspberry-pi\/#\/schema\/person\/e38fef75134e5e54175b2615a8c3eb47","name":"Nathan Busler","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/93fef66631dac0f47ce2c90f774cd4e4fe44028ea5266602e20fbf246f7d14f9?s=96&d=blank&r=g","caption":"Nathan Busler"},"sameAs":["https:\/\/buyzero.de"],"url":"https:\/\/picockpit.com\/raspberry-pi\/es\/author\/nathan\/"}]}},"_links":{"self":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/posts\/774","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/comments?post=774"}],"version-history":[{"count":18,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/posts\/774\/revisions"}],"predecessor-version":[{"id":6144,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/posts\/774\/revisions\/6144"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/media\/679"}],"wp:attachment":[{"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/media?parent=774"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/categories?post=774"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/picockpit.com\/raspberry-pi\/es\/wp-json\/wp\/v2\/tags?post=774"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}