2 Replies Latest reply on Apr 5, 2015 12:28 AM by Weishan

    FTP via Wi-Fi

    Weishan

      All,

       

      I got my Edison connected to the network via Wi-Fi. Now I want to create a sketch to ftp a file. I found the following sample code,

       

      Arduino Playground - FTP

       

      It didn't compile with arduino-1.5.3-Intel.1.0.4. It did compile with regular arduino IDE though. Any idea how to change the code to make it work for Edison?

       

      Thanks a lot!

        • 1. Re: FTP via Wi-Fi
          JPMontero_Intel

          Hi Weishan,

           

          When you are trying to use a sketch that was intended for Arduino in Galileo or Edison you have to make sure it does not contain AVR dependencies or AVR macros because the Architecture is different, you’d have to figure out workarounds for this AVR specifics. Another option would be to install a ftp or sftp package in the Linux side of the board, and you can use it in the Arduino side by using the system() function, just type the command you want to use in linux inside the fuction as a string ( between quotation marks “”).

          If you decide to give it a try to this method I’d suggest you to install openssh-sftp and openssh-sftp-server which are included in AlexT_Intel's repo, the guide on how to download these packages is in this site. Once you have followed the 3 steps in AlexT blog, you can install sftp with the command:

          opkg install openssh-sftp


          I’d suggest you to take a look at the man page for the sftp command http://linux.die.net/man/1/sftp . I tested it transfering a file from one Edison to another, by using the interactive mode. You can access interactive mode by typing in the command line sftp user@host (replace user with the user name and the host with the host ip address), then you would have to enter the user password to get access. Then use the commands in the man page under the title Interactive commands to navigate through the directories and get or send files from one device to the other. I hope you find this helpful.

           

          Regards,
          JPMontero_Intel

          • 2. Re: FTP via Wi-Fi
            Weishan

            JPMontero_Intel,


            Thank you very much for the reply! It turned out that SCP is already installed on Edison. And I use system() function you mentioned to invoke the scp command. It works!


            E.g.


            void setup() {

              // put your setup code here, to run once:

              system("scp /home/root/test.txt user@host:/nfs/home/user/test.txt");

            }