Receive .txt from PC with Arduino Yun

Hi everybody,

first, thank you for your interest to my topic.

So, here is my problem im a student and my teacher gave me a project to accomplish, this project is create a pedal MIDI (with buttons, LEDS, etc..), all controlled by an Arduino Yun. The Arduino Yun need to receive a configuration file (.txt or something) from a PC (which create the configuration file with Qt btw).

I did the most of the things to accomplish, but my last problem is to receive the file from the PC. I don't know how to do, which protcol use (TCP, FTP, ..).I simply need to receive a .txt file.. I saw some things with the Bridge class but i dont know anything in Python or even some Linux command (well only the basics)..
I also saw some things about YunClient class but i dont really get how she works.
Could the PC be a classic server in TCP coded in C or C++ for example and the Yun the client simply connected to this server with the YunClient class to receive this .txt file?

Really thank for reading me and sorry for my bad english..

Please could i have some help i dont want the solution but only suggestions or advices..
Thank you.

The simplest (and least interesting) is to use the USB serial port. The sketch uses the Serial class to open the USB port, and the PC sends the contents of the text file. But you are using a Yun, and you probably want to use a networked connection, especially since you mention TCP and FTP. There are many possibilities to do it over the network (note that all of these ideas work equally well over WiFi or wired Ethernet,MIT makes no difference to the Yun):

  1. You can set up a TCP server on the PC, and have the Yun act as a client and make the connection to the PC to get the configuration file contents. The Yun's side of this can be done on the Linux side of the Yun (using many different languages and methods) or it can be done in the sketch using the Bridge Library's YunClient class.

  2. You can set up a TCP server on the Yun, and gave the PC act as a client and make the connection to the PC to send the configuration data. Thev Yun's side can be again be done in Linux, or in the sketch using the Bridge Library's YunServer and YunClient classes.

  3. You can use the Yun's built-in web server to host a web service that uses HTTP protocols where the PC can make a web request to upload a file.

  4. You can use a web application framework like Bottle or Flask (or many others) to set up a web service that can receive the file (a simpler form of 3.)

  5. You can implement a REST API in the sketch that allows the PC to make multiple calls to the Yun to set various elements of the configuration (not really a file transfer.)

  6. You can use a framework from option 4, to implement a REST API like option 5 on the Linux side. (Also not really a file transfer.)

  7. You can use a framework from option 4 to implement a web service that receives the configuration data in an HTTP POST request as if the PC were filling out and submitting a form on a web page. (Also not really a file transfer.)

  8. You can set up a web server on the PC and use curl() on the Linux side to fetch the configuration file from the PC.

  9. Just like option 8, but use the Bridge Library's Process class to run the Lnux curl command from within a sketch.

  10. Similar to option 8, but use the Bridge Library's HttpClient class in a sketch to fetch the file.

  11. Use the SCP protocol on the PC to send the file to the Yun (the Yun is already running an SCP server.)

These are just some of the options I can think of off of the top of my head. I sure there are many others ways to do it.

Thank for your interest for my pb ShapeShifter! And many thanks for your answer!
You're really a nice guy, I saw you almost in every post i was looking before posting this one.

Your intervention on this one is really helpfull ! [Solved] Send/Receive TCP/IP strings (Yùn) - Arduino Yún - Arduino Forum

THANK YOU :smiley: