system
1
Im using Arduino Yun, this is my sketch:
#include <Bridge.h>
#include <Process.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 5, 10, 11, 12, 13);
void setup() {
Serial.begin (115200);
while(!Serial);
lcd.begin(16, 2);
Bridge.begin();
}
void loop() {
Process p;
p.runShellCommand("/usr/bin/test.lua");
while(p.available() > 0) {
char c = p.read();
lcd.print(c);
Serial.print(c);
}
Serial.println();
delay(10000);
}
Test.lua:
#!/usr/bin/lua
print("This shit doesn't work")
I tried to run /usr/bin/pretty-wifi-info.lua, so it works fine, but test.lua doesn't work. What am i doing wrong?
Openwrt is linux and case sensitive, Test.lua<>test.lua
nano /usr/bin/test.lua
#!/usr/bin/lua
print("This shit doesn't work")
chmod 755 /usr/bin/test.lua
make sure /usr/bin/test.lua is working.
/usr/bin/test.lua
This shit doesn't work
Arduino code:
#include <Process.h>
void setup() {
Serial.begin (9600); #9600 is default speed for monitor
while(!Serial);
Bridge.begin();
}
void loop() {
Process p;
p.runShellCommand("/usr/bin/test.lua");
while(p.available() > 0) {
char c = p.read();
Serial.print(c);
}
Serial.println();
delay(1000); #increase repeat print
}
sonnyyu:
chmod 755 /usr/bin/test.lua
As sonnyyu pointed out, your script must be executable. Otherwise, you need to call the interpreter and then the script, like
LittleTinie:
p.runShellCommand("lua /usr/bin/test.lua");