0

I have two devices connected to my Arduino using the SoftwareSerial library. However, it seems that they cannot communicate at the same time. I can only communiate with both by switching between which one I am listening to every 1000ms (they poll for 1500ms), but this slows down overall communication significantly. Is there anyway to communiate with both at the same time? Could this be achieved by using SoftwareSerial with one and the hardware serial port with the other?

asked Aug 22, 2015 at 1:41

1 Answer 1

0

See SoftwareSerial Write to return Read in Serial Monitor? - SoftwareSerial cannot both read and write at the same time.

However HardwareSerial can.

Could this be achieved by using SoftwareSerial with one and the hardware serial port with the other?

Yes.


So, likewise, there is no way to read from both devices using only SoftwareSerial?

That is correct. Not at the same time. SoftwareSerial uses an interrupt to detect the start bit of incoming data. So far so good. But once it gets it, it leaves interrupts disabled while it goes into a timed loop to read all the bits.

Thus, it is impossible for it to react to another incoming byte on another pin at the same time.

Still, you could receive on SoftwareSerial on one pin, and HardwareSerial on another. With HardwareSerial the hardware will run in the background, receiving the byte.

answered Aug 22, 2015 at 5:11
2
  • So, likewise, there is no way to read from both devices using only SoftwareSerial? Commented Aug 22, 2015 at 6:29
  • See amended answer. Commented Aug 22, 2015 at 6:54

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.