Arduino Yun Rev2 Power On avoid waiting for linux on Bridge.begin()

Hello,

i have a small sketch

...

void setup() {
  Bridge.begin();

  pinMode(MOTORLEFT_OUTPIN, OUTPUT);
  pinMode(MOTORLEFT_INPIN, INPUT_PULLUP);

  pinMode(MOTORRIGHT_OUTPIN, OUTPUT);
  pinMode(MOTORRIGHT_INPIN, INPUT_PULLUP);
  pinMode(ERRORLIGHT_OUTPIN, OUTPUT);

  pinMode(KALTLEITERFUEHLER_INPIN, INPUT_PULLUP);
  pinMode(MOTORSCHUTZ_INPIN, INPUT_PULLUP);
  pinMode(LECKOEL_INPIN, INPUT_PULLUP);

  digitalWrite(ERRORLIGHT_OUTPIN, 1);
}



void loop() {
    digitalWrite(MOTORLEFT_OUTPIN, digitalRead(MOTORLEFT_INPIN));
    digitalWrite(MOTORRIGHT_OUTPIN, digitalRead(MOTORRIGHT_INPIN));
    digitalWrite(ERRORLIGHT_OUTPIN, digitalRead(LECKOEL_INPIN));
}

...

So when i power on (connect the power adapter) linux needs to boot and so the µC needs to wait in the Bridge.begin() - Function. But i need to run the void loop() immediately. Is it a good idea to run a Timer for running Bridge.begin() after eg. 20 sec. or is there a better way?

thanks!

I'm not very experienced with the Bridge library, but it seems like a reasonable solution. However, you should note this part of the Bridge.begin() documentation:

begin() is a blocking function. Once you call Bridge.begin(), nothing else will happen in your sketch until it has completed. This process takes approximately three seconds.

If it's a problem to have your code blocked for ~3 seconds after it's started running, it might be better to stick with the approach of calling Bridge.begin() at the start of setup. That results in a long delay at startup before your code runs, but at least once the code starts running it won't be subjected to being blocked for long durations.

If you can’t start your Yun three seconds sooner and can’t wait three seconds, this sounds like an xy problem. What are you REALLY trying to do?

The program should control an electric engine from both local buttons on a joint box and from a pc witch is in the same network. The Problem is the bootup-time of the linux on the arrduino-board. The time is too long, so the µC doesnt read the states of the local buttons. I dont want to wait so long when i power on the arduino.

I use the Bridge to communicate with a python-script on the linux side - is there an other way?

I don't know what a joint box is. I don't know what the Bridge is. An Arduino does not have Linux on it unless you put it there.

I think that I see your time issue. Thanks.

vaj4088: I don't know what the Bridge is.

Bridge is the library that is used for communication between the ATmega32U4 and the Atheros AR9331 module on the Yun Rev2: https://www.arduino.cc/en/Reference/YunBridgeLibrary

vaj4088: An Arduino does not have Linux on it unless you put it there.

The Yun boards come with Linux pre-installed on the Atheros AR9331 module: https://store.arduino.cc/arduino-yun-rev-2