Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« on: July 25, 2012, 06:06:45 pm » |
Is it possible to run a file, .Lua, .Jar, .py, etc? If so, how can this be achieved?
|
|
|
|
« Last Edit: July 26, 2012, 01:19:50 am by nate890 »
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 15
Posts: 1003
Arduino rocks
|
 |
« Reply #1 on: July 25, 2012, 06:21:46 pm » |
Depends on what you mean by "run"
But no.
|
|
|
|
|
Logged
|
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #2 on: July 25, 2012, 06:38:10 pm » |
Dang... If I were able to run a .Lua I would be able to interact with the computer and play .mp3s and such.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 15
Posts: 1003
Arduino rocks
|
 |
« Reply #3 on: July 25, 2012, 06:55:06 pm » |
You can interact with your computer by sending serial commands, and writing a program that runs on the computer to listen to them and do stuff. The arduino doesn't have a lua interpreter, a python interpreter, or a JRE on it, though, and probably doesn't have enough resources to run one.
|
|
|
|
|
Logged
|
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #4 on: July 25, 2012, 07:03:29 pm » |
How would I send a serial command from arduino?
|
|
|
|
|
Logged
|
|
|
|
|
Anaheim CA.
Offline
Edison Member
Karma: 31
Posts: 2307
Experienced old Whitebeard with a Full head of Hair...
|
 |
« Reply #5 on: July 25, 2012, 09:59:10 pm » |
By defining a serial port with SoftwareSerial and sending the data... (RTFM... Read That Fine Manual)!
Doc
|
|
|
|
|
Logged
|
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
|
|
|
|
Offline
Edison Member
Karma: 15
Posts: 1003
Arduino rocks
|
 |
« Reply #6 on: July 25, 2012, 10:04:57 pm » |
By defining a serial port with SoftwareSerial and sending the data
Er.. no... the hardware serial port will work fine. The DigitalReadSerial example shows how to read a switch and then write to the serial port. If you're new to things, I've heard gobetweeno lets your arduino run programs on your computer. Try checking that out. I've never used it, though.
|
|
|
|
|
Logged
|
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #7 on: July 25, 2012, 10:10:09 pm » |
I've tried gobetwino, doesn't work with windows 7..
Also, I saw a tutorial on youtube by Jeremy Blum about serial communication, and he did it using the language processor, and he said that you can interact with your computer from arduino using any programming language... Now, that being said it should be possible with Lua, so how can this be done with Lua?
|
|
|
|
|
Logged
|
|
|
|
|
Canada
Offline
Full Member
Karma: 0
Posts: 246
Code Monkey
|
 |
« Reply #8 on: July 25, 2012, 10:48:46 pm » |
I've tried gobetwino, doesn't work with windows 7..
Also, I saw a tutorial on youtube by Jeremy Blum about serial communication, and he did it using the language processor, and he said that you can interact with your computer from arduino using any programming language... Now, that being said it should be possible with Lua, so how can this be done with Lua?
Many different ways. This is the whole reason for "Processing". If you want to do a mini Processing in Lua, start writing code. Write a Lua app that listens on a connection. When it gets something, it gets that something, parses it in some manner and then acts on the stuff it parses out. Your question is infinitely general. You will get better results trying stuff out. Get the Arduino logging to a Java or Lua app that simply reports changes when you hit a button or something. Then build on that.
|
|
|
|
|
Logged
|
I yield() for co-routines.
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #9 on: July 25, 2012, 11:05:13 pm » |
>.<. Let's say there is a .Lua file, named open.lua, with the following code: os.execute([[start "" "C:\\Users\\User\\Documents\\Song.mp3"]]) When that code is ran, a .mp3 file, named "Song" will play.
And this is why I was asking if it was possible to RUN A .LUA FILE from ARDUINO, not make a .Lua file detect when I want code to run (which would be super hacky, and it being Lua, I don't even think this would be possible (what above suggested)) Which is why "Write a Lua app that listens on a connection. When it gets something, it gets that something, parses it in some manner and then acts on the stuff it parses out." is more easily said than done.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 15
Posts: 1003
Arduino rocks
|
 |
« Reply #10 on: July 25, 2012, 11:10:15 pm » |
An arduino can not automagically do anything on your computer except fill up its serial buffer. Something has to be written to read that serial buffer and do something with the contents. Lua can read the serial port, so one script is all you technically need.
|
|
|
|
|
Logged
|
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #11 on: July 25, 2012, 11:10:59 pm » |
Also, "When it gets something", when it gets what? There is no way, with Arduino (that I know of so far) that would allow me to send something that would be detectable. For instance, if Arduino was able to create a file, I could loop until a file is detected then execute code. But then again, Arduino can't do this.
What should be done on the Arduino team's part is to create a function that can interact with your computer (as simple as os.execute(), or system() (in C), instead of inefficiently having to do it through other programming languages.
|
|
|
|
|
Logged
|
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #12 on: July 25, 2012, 11:12:31 pm » |
"Lua can read the serial port, so one script is all you technically need." Do you know how this would be done? No need for code, just an explanation. Thanks.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 15
Posts: 1003
Arduino rocks
|
 |
« Reply #13 on: July 25, 2012, 11:13:20 pm » |
What should be done on the Arduino team's part is to create a function that can interact with your computer (as simple as os.execute(), or system() (in C), instead of inefficiently having to do it through other programming languages.
An arduino can ONLY send serial data to the computer, and nothing in the arduino's software can change that. You could write something similar to bash that reads from the serial port rather than a keyboard, which would be a generic handler. "Lua can read the serial port, so one script is all you technically need." Do you know how this would be done? No need for code, just an explanation. Thanks.
Nope, never programmed in lua. Have you googled it?
|
|
|
|
|
Logged
|
|
|
|
|
Brampton, Ontario
Offline
Full Member
Karma: 0
Posts: 112
|
 |
« Reply #14 on: July 25, 2012, 11:23:16 pm » |
"Nope, never programmed in lua. Have you googled it?" Not yet, gotta go out, will when I get back.
|
|
|
|
|
Logged
|
|
|
|
|
|