2 Replies Latest reply on Jan 8, 2014 2:50 PM by roleyrev

    Calling Python from a sketch (and storage)

    roleyrev

      Hi all,

       

      I would like to call some simple python routines into action from either a boot time loader or a sketch.  The python is just some simple variable tracking over a TCP connection, the sketch is to drive some ir LED's and manage information coming from TCP sockets to UDP packets for use on a multidrop information system.

      I see that you can use the command "system", as I have found already on the forum, using it to start a telnet session to log on by a telnet client over Ethernet. Question is HOW and WHERE do I place the python script to be able to be called by a line in the setup:

      system("python //home/usr/BOB.py");

      or some such?

      Is there an FTP server that can be set up to accept files to be placed in a appropriate place.

      Currently I have been using  Raspberry Pi and an Arduino mega to achieve this outcome.

       

      Another question:- how many concurrent TCP/UDP sockets can the Ethernet on the Galileo support?.  I currently use the maximum allowable on the WIZ5100 Ethernet shield which is 4, it would be handy to have a few more ports.

       

      John

        • 1. Re: Calling Python from a sketch (and storage)
          Clayton Hofrock

          The easiest place to store your python scripts would be on an SD card. I would reccommend, an SD card with the Little Linux on it. (https://communities.intel.com/docs/DOC-22226) Click on the "LINUX IMAGE FOR SD"

           

          All you should have to do is to unzip that file onto an SD card that is formatted as a FAT or FAT32. (also, be sure to update your firmware {via the Arduino software} if you have not done that yet.

           

          If you store your files on the top level of the SD card, the Linux path to it will be in the directory: /media/mmcblk0p1/

           

          I think you can start an FTP server if you want to do that, but the SCP server runs by default (I think) and I personnally think that is a better option.

           

           

          Also, if you want this python script to run all the time you should be able to start it by changing the /etc/init. More information on that is available here: Ubuntu's Success Story: the Upstart Startup Manager

           

          Note: the Galileo is not running Ubuntu, but this method can still be used.

          • 2. Re: Calling Python from a sketch (and storage)
            roleyrev

            Thanks for that info.  I have the Galileo sorted for the latest firmware and booting from SD so that's all good. Your pointers to the start-up procedures is most helpful, as is the mount point for the files on the root  the SD.  Also the info on the SCP server, this is great and exactly what I require to run