有没有将Arduino代码转换为C代码的方法或教程? [英] Is there a way or tutorial for converting Arduino code to C code?

查看:581
本文介绍了有没有将Arduino代码转换为C代码的方法或教程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题很笼统,但是我找不到转换Arduino代码的教程或良好的编码方式(我的意思是我们在Arduino软件上编写的代码,对于 Arduino Uno Mega 或...),即使是小样本.

有教程吗?

我只想学习这项技术,我知道这取决于项目.

解决方案

Arduino代码,或多或少是C代码.

Arduino发生的独特事情是对代码进行了预处理(例如,它们通过建立setuploop函数而提供了简单的挂钩),并且具有托管的构建/上传过程,该过程可以满足开发板上的限制,包括库等...

当然可以自己使用相同的工具包来构建和运行代码,这就是我的方法. Arduino和GCC,仅使用makefile编译和上传程序 我发现了有用的链接,其中涵盖了您入门所需的步骤.

正如我所说,我自己离开了Arduino IDE并接受了avr-gcc路由,因为如果您知道GNU工具,则可以做很多更强大的事情-像使用C ++标准库一样.我错过了我的vector,我能说什么.在完整的C ++功能方面, avr-libc 落后很多.在 STL 中添加,但Arduino Uno or Mega or ... ) even if a small sample.

Is there a tutorial?

I just want to learn the technique, and I know that it depends on the project.

解决方案

Arduino code is, more or less, C code.

The unique things that happen with Arduino is that the code is preprocessed (for example, they give simple hooks by establishing the setup and loop functions) and has a managed build/upload process that takes care of board limits, includes, libraries, etc...

It is certainly possible to use the same toolkit yourself to build and run the code, that's how I do it. Arduino and GCC, compiling and uploading programs using only makefiles is the most useful link I've found covering the steps you need to get started.

As I said, I've left the Arduino IDE and taken up the avr-gcc route myself, because if you know the GNU tools, you can do much more powerful things - like use the C++ standard libraries. I missed my vectors, what can I say. avr-libc is lagging quite a bit when it comes to full C++ functionality, making it hard to cram in the STL, but Andy Brown has gotten much of it working.

Throw those things together and you have quite a powerful development environment.

这篇关于有没有将Arduino代码转换为C代码的方法或教程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆