4 Replies Latest reply on Sep 13, 2015 10:44 AM by Pb1

    Run sketch on boot



      I'm trying to make my Arduino sketch on boot but nothing seems to work, i followed the instructions given here: Blink a LED at startup but even with the simplest sketch (blink) it doesnt run on boot, i have to recompile/upload with the IDE every time i want to run the sketch, which is not acceptable.

      My edison board is running the latest firmware and i have the latest arduino IDE


      root@Edison:~# uname -a
      Linux Edison 3.10.17-poky-edison+ #1 SMP PREEMPT Fri Jun 19 12:06:40 CEST 2015 i686 GNU/Linux


      If im not mistaken clloader is the module that should run the sketch on boot up, here is its status: http://textuploader.com/eo9l

      Here is the boot log if it can help identify the problem : http://textuploader.com/eo9f

      Can anybody help ? This is so frustrating...



        • 1. Re: Run sketch on boot

          Hello AliDouiyek,


          The issue you describe sounds pretty weird, in my personal experience I've never faced such issue. So, right now the only suggestion I can think of is to try to reflash your board to see if that helps.



          • 2. Re: Run sketch on boot

            Hi Peter,


            Seems like it is related to the latest release ww25.5-15, I downgraded to ww18-15 and it solved the problem. So I decided to upgrade again to 25.5-15 but the problem appeared again, so i'll just stick with the previous firmware.

            Thanks for your advice.



            • 3. Re: Run sketch on boot

              Here is how I managed to fix this issue or at least work around it.


              1st create a startsketch script under /sketch:


              vi startsketch



              # script to start arduino based sketches

              cd /

              cd sketch

              if [ -f $1 ]


                 echo "file $1 exists"

                 echo "preparing $1 with chmod"

                 chmod +x $1

                 echo "starting $1 as background process"

                 ./$1 /dev/ttyS0 > /dev/null 2>&1 &


                 echo "file $1 does not exist"



              Then make it executable

              chmod +x startsketch


              test it:


              startsketch sketch.elf


              it should start your sketch


              next cd /etc

              mkdir init.d

              vi  sketch.sh




              cd /sketch/

              ./startsketch sketch.elf



              then make it executable

              chmod +x sketch.sh



              Now test it:



              it should start sketch.elf


              Make the script run at every boot


              update-rc.d sketch.sh


              Now reboot and voila latest firmware and auto start sketches

              • 4. Re: Run sketch on boot

                The real issue is why should any user have to go through what you did?