Intel Edison开机自动加载Arduino代码

来源:互联网 发布:归并排序算法过程图解 编辑:程序博客网 时间:2024/05/16 06:31
there is a known issue with that version. The Arduino sketchesdon't start automatically after the board reboots. You could do oneof the following suggestions to solve it:

1.You can re-flash the Edison with the previous image which doesn'tpresent this issue. The previous image can be downloaded from thefollowing site: Intel Edison Software Release 2.1
2.The other suggestion would be the workaround described in thisthread: Run Arduino sketch on boot Workaround. With this workaroundyou will be able to keep using the latest yocto image.

https://communities.intel.com/thread/93732
可以按1的方法降级到1.6.1后能自动运行。

如果不想降image可以按照下面的方法进行。打开PuTTY,串口连接Edison。

若您第一次使用 init.d 启动脚本,必须首先创建目录,之后跳至第 2 步:

第 1 步

 root@edison:~# mkdir/etc/init.d

现在进入目录,

第 2 步。

root@edison:~# cd /etc/init.d


接下来,我们要在文件中创建一个包含启动命令的 bash 脚本。 在本案例中,我们要对 Arduino sketch进行自动化处理,以便其在启动时运行。

在任何情况下,打开您的首选文本编辑器,创建脚本 automateSketch.sh:

root@edison:/etc/init.d# vi automateSketch.sh

将以下内容添加至该脚本。

#!/bin/sh
exec /sketch/sketch.elf /dev/ttyGS0 /dev/ttyGS0

只需两条指令,本教程就已接近尾声。

现在我们用 chmod 更改许可,以便该脚本成为可执行脚本。

root@edison:/etc/init.d# chmod +x/etc/init.d/automateSketch.sh
root@edison:/etc/init.d# chmod +x automateSketch.sh

为确保 linux 每次启动时都可以执行该脚本,发送以下命令,并等待返回,如下所示

root@edison:/etc/init.d# update-rc.d automateSketch.shdefaults
Adding system startup for /etc/init.d/automateSketch.sh

好的,完成了!我们来看看它是否可行!

root@edison:/etc# reboot


现在,您可以看看 Arduino sketch 是否自动运行。

 

查看全文

0 0
原创粉丝点击