tag:blogger.com,1999:blog-1932348031972432971.post3043659009958938670..comments2023-10-07T10:48:50.893+02:00Comments on mips & chips: Publicar en twitter desde Arduino.Pablo Trujillohttp://www.blogger.com/profile/09951479955770372347noreply@blogger.comBlogger3125tag:blogger.com,1999:blog-1932348031972432971.post-37317669906685709932014-07-28T02:09:21.507+02:002014-07-28T02:09:21.507+02:00Es curioso, nunca me había fijado.
En todo caso no...Es curioso, nunca me había fijado.<br />En todo caso no es cosa del IDE (el IDE apenas hace nada), sino cosa del compilador (avr-gcc). He estado buscando por ahí, y parece ser que deshabilitan esta funcionalidad por defecto para reducir el tamaño final del programa, pero existe una forma de volverla a añadir (algo tediosa ya que el IDE no permite pasar parámetros al compilador).<br />La he encontrado aquí y copio y pego la parte interesante.<br />http://forum.arduino.cc/index.php?topic=124809.msg938573#msg938573<br /><br />"The trick is finding the correct libc.a file as there is is libc.a for each AVR architecture.<br />If you are using linux and Arduino 1.0.1 then the directory you want to go to (for the mega328)<br />is {installdir}/hardware/tools/avrlib/avr/lib/avr5<br />Note: Prior to Arduino 1.0.1, the Linux IDE did not ship with a compiler and librarys.<br />So if not using Arduino 1.0.1, then you have to locate the avr5 library down in the local system.<br />(This can be different places depending on which release of the tools and which repo you are using)<br /><br />Once you get down into the avr5 directory:<br />Make a copy of the original libc.a<br />cp libc.a libc.a.orig<br /><br />You extract & remove the std vfprintf() with:<br />ar -dv libc.a vfprintf_std.o<br /><br />You extract the floating point vfprintf() with:<br />ar -xv libprintf_flt.a vfprintf_flt.o<br /><br />You put the floating point vfprintf() into libc.a with:<br />ar -rv libc.a vfprintf_flt.o<br /><br />After that, you you now have floating point xxprintf() support<br />for the m168/m328, 32u4, and m644 processors by default.<br /><br />For the Arduino Megas, you will have to modify the libc.a in<br />avr51 and avr6"<br /><br />He visto también que hay gente que recurre a hacerse funciones del tipo "str2f()".<br /><br />Saludos!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-1932348031972432971.post-21145860450956142702014-07-27T20:40:54.319+02:002014-07-27T20:40:54.319+02:00La instrucción sprintf() que implementa el IDE de ...La instrucción sprintf() que implementa el IDE de Arduino no permite formatear variables en coma flotante de esa forma, el número sale mal y con un ?, por eso hay que formatearlo de esa forma.<br />Un saludo!Pablo Trujillohttps://www.blogger.com/profile/09951479955770372347noreply@blogger.comtag:blogger.com,1999:blog-1932348031972432971.post-29479040504497376252014-07-27T18:26:13.032+02:002014-07-27T18:26:13.032+02:00Tío, no me seas así, formatea el float como es deb...Tío, no me seas así, formatea el float como es debido.<br />sprintf(msg, "Hola! La temperatura ahora es de %.1f ºC.", temp);<br /><br />Hasta la próxima!Anonymousnoreply@blogger.com