I am new to using Arduino Yun and I would like to know if it is possible to run an entire script on the Linux side. In my case the script should execute a HTTP request to a remote server, parse the subsequent HTTP response and return some value that then can be used in the Arduino sketch.
If it is possible, what I have to do? For example, how should I write and run script files? what programming language should I use? where I should put those script files on the Linux side?
-
Not a Yun expert but shell commands seem easy on the Yun. I don't know much about adding a script to it, so feel free to build off of this and post an answer.Anonymous Penguin– Anonymous Penguin2014年04月11日 21:05:26 +00:00Commented Apr 11, 2014 at 21:05
-
Don't know anything about Yun but I'd look at the FileIO class to make a file and write your script into it. Then use Process class to execute it.sachleen– sachleen2014年04月11日 21:24:44 +00:00Commented Apr 11, 2014 at 21:24
1 Answer 1
Arduino Yun ships with python pre installed. You can copy python scripts from your pc to the yun with scp
(or WinSCP or putty
, if you're on windows). Once copied, just run it using Process from your sketch. As they are scripts, program name is python
and the path to your script is its first argument (you can do that in a different way, but that would require some linux magic, which I suggest to postpone if you're new to it).
Other pre installed options include lua and bash. Other languages such as ruby, erlang and php are available as optional packages.
-
In which directory on Yun should I put my script files?user502052– user5020522014年04月15日 12:02:30 +00:00Commented Apr 15, 2014 at 12:02
-
Wherever, but the sd card is the preferred choice, so you don't wear out the flash. If you have an sd card with an
arduino
folder, you should have it available at/mnt/sd
Federico Fissore– Federico Fissore2014年04月15日 14:48:12 +00:00Commented Apr 15, 2014 at 14:48