如何用C编程的Arduino ++ [英] How to program arduino with C++

查看:313
本文介绍了如何用C编程的Arduino ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,最近我一直在玩弄我的Arduino的,我想知道,如果有一些方法,我可以在C ++中的Arduino编程。我一直在做的是使用在vim的C ++ /处理语言,并用makefile编译并上传到Arduino编程它。但我的目标是能够使用类和所有伟大的C ++特性(或者至少总和)来编程。最后,我甚至会喜欢它原始的C程序,我只是有麻烦找出如何做到无论是。这将是巨大的,如果有人能指出我在正确的方向,或帮助我。谢谢! 〜迈克尔

So lately I've been playing around with my arduino and I was wondering if there was some way I could program the arduino in c++. What I've been doing is programming it using the c++/processing language in vim and using a makefile to compile and upload to the arduino. But my goal is to be able to use classes and all the great C++ features (or at least sum) to program it. Eventually I would even love to program it in raw c and I'm just having troubles finding out how to do either. It would be great if someone could point me in the right direction or help me out. Thanks! ~michael

推荐答案

下面是我的经验:我使用的Arduino,传感器,电机,带动和蓝牙建设智能机器人玩具为自闭症儿童。我写我自己的库做的正是我需要使用C ++。但我发现,在Arduino的IDE编译器是不支持新的C ++ 11功能的旧版本。

Here is my experience: I'm building a robotic smart toy for autistic children using Arduino, sensors, motors, led and bluetooth. I wrote my own libraries to do exactly what I needed using C++. But I found out that the Arduino IDE Compiler is an older version that does not support the new C++11 features.

所以我不得不发现自己的方式来编译C ++ 11 code和它上传到我的Arduino。原来是pretty基本:我需要一个Makefile,ACR-GCC 4.8瞧!
makefile文件作业由Sudar完成( https://github.com/sudar/Arduino-Makefile ),它的伟大工程。我不得不定制它一下,使之成为我的项目工作,但

So I had to find myself a way to compile C++11 code and upload it to my Arduino. It turns out to be "pretty" basic: I needed a Makefile, acr-gcc 4.8 and voilà! The makefile job is done by Sudar (https://github.com/sudar/Arduino-Makefile) and it works great. I had to customise it a bit to make it work for my project though.

下面是一些文档,我为我的项目写的。你应该看一看,这可能是对你有用。 <一href=\"https://github.com/WeAreLeka/moti/blob/master/INSTALL.md\">https://github.com/WeAreLeka/moti/blob/master/INSTALL.md

Here is some documentation I've written for my project. You should take a look, it might be useful for you. https://github.com/WeAreLeka/moti/blob/master/INSTALL.md

希望它帮助!
干杯:)

Hope it helps! Cheers :)

修改2014年8月16日:

由于我得到了很多类似这样的朋友和其他开发者一个请求,我决定建立某种的框架的站起来,用你的Arduino的项目快速,轻松地运行。

Because I got a lot a requests similar to this one from friends and other devs, I decided to set up some kind of framework to get up and running with your Arduino projects quickly and easily.

这是裸Arduino的项目

希望它可能是任何帮助!如果您发现错误或东西,我可以更好地,随意填写和问题。 :)

Hope it could be of any help! If you find bugs or stuff that I could make better, feel free to fill and issue. :)

这篇关于如何用C编程的Arduino ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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