arduino linux版本安装使用

本文介绍了在Linux环境下安装Arduino IDE 0023和1.0.5版本的过程,以及遇到的编译错误和串口权限问题。在安装过程中,通过参考特定链接解决了delay.h和math.h头文件的编译冲突。对于无法选择Serial菜单和打开串口的问题,解决方案包括以管理员权限运行IDE或使用chmod命令赋予设备文件权限。

较新的版本是1.0.5。但为了研究之前的开源代码,pde格式项目文件,只能从0023版本开始搞。

安装过程见:http://playground.arduino.cc/Linux/Ubuntu

sudo apt-get install gcc-avr avr-libc

或参考:http://www.pluggy.me.uk/arduino-ubuntu/

然后下载需要的版本包,解压后直接运行 ./arduion即可打开ide。


遇到的问题:

1.  arduino0023 for ubuntu版本里,tutorials工程就有编译错误。

现象及解决办法:

参考:https://groups.google.com/forum/#!topic/linux.debian.bugs.dist/9E6wE0b5wiw

In file included from /usr/lib/gcc/avr/4.5.3/../../../avr/include/util/delay.h:44:0,
                 from /usr/lib/gcc/avr/4.5.3/../../../avr/include/avr/delay.h:37,
                 from /usr/share/arduino/hardware/arduino/cores/arduino/wiring_private.h:30,
                 from /usr/share/arduino/hardware/arduino/cores/arduino/WInterrupts.c:34:
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected identifier or ‘(’ before ‘double’
/usr/lib/gcc/avr/4.5.3/../../../avr/include/math.h:426:15: error: expected ‘)’ before ‘>=’ token

which is caused by the macro definition of round() in wiring.h:
#define round(x)     ((x)>=0?(long)((x)+0.5):(long)((x)-0.5))

commenting out this line fixes this final compliation error and the program compiles, uploads and correctly works on the Arduino that I have.

2. arduino0023及1.0.5版本,编译成功后无法选择对应的ttyACM0端口。因为Serial菜单是灰色的。

解决办法: sudo  ./arduino

此问题与putty中经常遇到的无法打开串口问题是类似的。解决办法是sudo putty即可。

如果/dev/ttyUSB0或/dev/ttyACM0仍然无打开权限。有一个办法就是chmod 777 /dev/ttyUSB0 这样就好了。



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值