reading from 4 SoftwareSerials one after another


hey everybody,

i tried connect 4 sensors via softwareserial arduino micro.
the sensors send data once every second. it's not critical me every data arrives correctly, maybe 50% great. read signals 2 sensors without problems, try implement 3rd 1 don't signal from (code below). sensors connected pins (rx) 8, 9, 10, 11. succesfully tested these single softwareserial.
do have suggestions why happens? or how solve it?

thanks in advance help

code: [select]

sensor01receive = true;

//reading sensor01
if (sensor01receive) {
   //
   if (!sensor01.islistening()) {
     sensor01.listen();
   }
   if (sensor01.available() > 0) {
     capturedata(sensor01);
     sensor01receive = false;
     sensor02receive = true;
     sensor03receive = false;
   }
 }
//reading sensor02
if (sensor02receive) {
   if (!sensor02.islistening()) {
     sensor02.listen();
   }
   if (sensor02.available() > 0) {
     capturedata(sensor02);
     sensor01receive = false;
     sensor02receive = false;
     sensor03receive = true;
   }
 }
//reading sensor03
if (sensor03receive) {
   if (!sensor03.islistening()) {
     sensor03.listen();
   }
   if (sensor03.available() > 0) {
     capturedata(sensor03);
     sensor01receive = true;
     sensor02receive = false;
     sensor03receive = false;
   }
 }

perhaps there's wrong code. however, snippet isn't enough show you've done wrong. please post complete sketch demonstrates problem. if sketch includes lot of code not relevant problem suggest create minimal sketch demonstrates problem in simplest way can think of. quite often, creating enable solve problem yourself. if doesn't, you've still reduced amount of code need wade through understand problem.


Arduino Forum > Using Arduino > Project Guidance > reading from 4 SoftwareSerials one after another


arduino

Comments

Popular posts from this blog

opencv3, tbb and rasp pi 2 - Raspberry Pi Forums

small ethernet problem - Raspberry Pi Forums

Multithumb configuration params not working? - Joomla! Forum - community, help and support