Click here to Skip to main content
14,165,627 members
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

5.2K views
Posted 20 Jan 2016
Licenced CPOL

Procedure to Autostart the Arduino Sketch on Edison

, 20 Jan 2016
Rate this:
Please Sign up or sign in to vote.
Procedure to Autostart the Arduino Sketch on Edison

This article is for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers

Get access to the new Intel® IoT Developer Kit, a complete hardware and software solution that allows developers to create exciting new solutions with the Intel® Galileo and Intel® Edison boards. Visit the Intel® Developer Zone for IoT.

Running Arduino sketch at System Start-Up

There are many ways to do this, but on Edison I found that the easiest way is using the /etc/init.d directory. There are many references out there for why and how this works, a good one can be found here. If this is your first time using init.d for start-up scripts, you’re going to have to first create the directory else skip to Step 2:

Step 1

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

Now lets switch into that directory,

Step 2

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

Next, we’re going to create a bash script in this folder that contains our boot commands. In this case, we’re automating the Arduino sketch to run at startup.

In any case, open your favorite text editor and create the script automateSketch.sh:

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

Add the following contents into the script.

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

Really, it’s just the two commands and we landed on at the end of our tutorial.

Now we can make the script executable by changing the permissions with chmod.

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

Now, to make sure this script is executed every time linux boots, issue the following command and wait for the return shown below

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

Well!!, We are done! we can see if it Worked!

root@edison:/etc# reboot

Now you can see if the Arduino sketch auto starts.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Intel Corporation
United States United States
You may know us for our processors. But we do so much more. Intel invents at the boundaries of technology to make amazing experiences possible for business and society, and for every person on Earth.

Harnessing the capability of the cloud, the ubiquity of the Internet of Things, the latest advances in memory and programmable solutions, and the promise of always-on 5G connectivity, Intel is disrupting industries and solving global challenges. Leading on policy, diversity, inclusion, education and sustainability, we create value for our stockholders, customers and society.
Group type: Organisation

43 members


You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web01 | 2.8.190518.1 | Last Updated 20 Jan 2016
Article Copyright 2016 by Intel Corporation
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid