Go Down

Topic: Two Arduinos (Read 330 times) previous topic - next topic

Taskmgr

Is it possible to connect two different Arduino UNOs to each other in a way that they will display only one Serial Port while being able to run two different loops?

More detail: I'm writing some data to an SD card. But I need two different data from two different loops and I don't want to use two different SD modules and two SD cards, I want them to record in one single card. Is such thing possible? Or could I perhaps use one SD module and parallel connect it to two Arduinos, gathering data simultaneously?

Thank you.

wildbill

You could connect the two Unos using softwareSerial and have the device with the SD card tell the other Uno what it read.

But if you can do that, then perhaps you can read the data from two files and have a single Uno do the processing. It's not clear to me why you need two Unos.

sterretje

Why can't your two different loops not run on one Arduino?
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Taskmgr

Because I read that it is not possible to run two different loops in one Arduino UNO. Isn't that right?

wildbill

You can't have multiple functions called loop. You can have more than one thing invoked from your loop function though.

CrossRoads

Or make loop-like functions:
Code: [Select]

void loop(){
// maybe read a pin?
  if (digitalRead(pinX) == HIGH){
  loop1();
  }
  else { // pin is LOW
  loop2();
  }
}

void loop1(){
// do whatever
}

void loop2(){
// do whatever
}
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Go Up