Hi guys,
I have a issue with my yun in conjunction with python. The python script sends udp broadcasts and works fine from ssh.
Case 1.
I connect my arduino by usb and upload my ino file, the python script works properly
Case 2.
if I start the arduino with the uploaded file from scratch, the python script doesn’t work.
It seems like a timing issue. I tried with several delays in the setup method to give linux a chance to start up but without success.
#include <Process.h>
String sText = "python /$HOME/send_udp.py off";
unsigned int runShellCmd(const String &cmd)
{
Process p;
p.runShellCommand(cmd);
while(p.running());
while (p.available() > 0)
{
char c = p.read();
Serial.print(c);
}
Serial.flush();
}
void setup()
{
delay(80000);
Bridge.begin(); // Initialize the Bridge
Serial.begin(9600); // Initialize the Serial
// Wait until a Serial Monitor is connected.
while(!Serial);
Serial.println("Running Shell Commands...");
for (int i=1;i<20;i++)
{
runShellCmd(sText);
Serial.println(i);
delay(1000);
}
Serial.println("\nEnd.");
}
void loop()
{
Serial.println("... in loop");
runShellCmd(sText);
Serial.println(i);
delay(1000);
}
Thanks for your help
Andreas