2 Replies Latest reply on Aug 5, 2015 7:30 AM by JinLemon

    Android sketch from Python script in Galileo Gen2

    JinLemon

      Hello to everyone.

      I would to know if it´s possible to start an Arduino sketch from a Python script: I know that it´s possible to do the contrary with system() command, but when I do so, for some reason, interrupts (from 2 buttons) are not responding.

       

      Thank you for everyone wants to help me

        • 1. Re: Android sketch from Python script in Galileo Gen2
          DiegoV_Intel

          Hi JinLemon,

           

          Yes, it is possible; however the Arduino sketch always run automatically after the board has booted. Every time you upload a new sketch, it is stored in the /sketch directory and run automatically after you upload it, or after a reboot (if you are using the SD Image).

           

          You could stop the sketch and then re-run it again whenever you want. You can do that from a Python script. The system command that you use in an Arduino sketch can be used in a Python script as well, but you have to import the os library before: import os.

           

          The system command follows the syntax below:

          • os.system('Linux command')

           

          If you want to stop the Arduino sketch running in Galileo you should use the following line in your Python script:

          • os.system('killall -HUP clloader')

           

          On the other hand, if you want to re-run the Arduino sketch you should use the following line:

          • os.system('killall -TERM clloader')

           

          I hope this information is what you are looking for.

           

          Regards,

          Diego.

          • 2. Re: Android sketch from Python script in Galileo Gen2
            JinLemon

            Yes, it's what I needed. Thank you very much!