第八步:替换一些文件
在终端依次输入以下命令:
cd arduino-1.0
for i in $(find . -name "librxtxSerial.so") ; do cp /usr/lib/jni/librxtxSerial.so $i ; done
for i in $(find . -name "RXTXcomm.jar") ; do cp /usr/share/java/RXTXcomm.jar $i ; done
cp /usr/bin/avrdude /home/pi/arduino-1.0/hardware/tools/avrdude
cp /etc/avrdude.conf /home/pi/arduino-1.0/hardware/tools/avrdude.conf
这样Arduino IDE在你的树莓派上就安装完成了
运行方法如下:
在终端依次输入以下命令:
cd arduino-1.0/
./arduino
这样你就会发现Arduino IDE已经成功运行
如果你在编译程序时出现以下错误:
~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp: In member function ‘size_t Print::print(const __FlashStringHelper*)’:
~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:44:9: error: ‘prog_char’ does not name a type
~/arduino-1.0/hardware/arduino/cores/arduino/Print.cpp:47:23: error: ‘p’ was not declared in this scope
解决方法如下:
在终端中输入vim arduino-1.0/hardware/arduino/cores/arduino/Print.cpp
找到以下代码:
size_t Print::print(const __FlashStringHelper *ifsh)
{
const prog_char *p = (const prog_char *)ifsh;
size_t n = 0;
while (1) {
unsigned char c = pgm_read_byte(p );
if (c == 0) break;
n = write(c);
}
return n;
}
修改成如下:
size_t Print::print(const __FlashStringHelper *ifsh)
{
const char PROGMEM *p = (const char PROGMEM *)ifsh;
size_t n = 0;
while (1) {
unsigned char c = pgm_read_byte(p );
if (c == 0) break;
n = write(c);
}
return n;
}