Running shell command through Bridge
in Arduino Yun
through a Process
let's say, proc
, it gives result and we can read the result bytes using following piece of code.
#include <Bridge.h>
#include <Process.h>
void setup() {
Bridge.begin();
Serial.begin(9600);
while (!Serial);
}
void loop() {
Process proc;
proc.runShellCommand("ls /root/");
while (proc.available() > 0)
Serial.print((char)proc.read());
Serial.println();
}
What if I have to access data from a blocking shell command as it gets updated like and event
? Such as, some consumer that listens to Kafka
or Mosquitto
subscribed topic. Whenever that topic is updated/published with new data, the listener gets it.
How can I model such structure using Arduino Yun
program using Bridge
.