Skip to main content
Arduino

Return to Answer

replaced http://arduino.stackexchange.com/ with https://arduino.stackexchange.com/
Source Link

See SoftwareSerial Write to return Read in Serial Monitor? 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.

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.

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.

Added explanation about receiving two bytes at once.
Source Link
Nick Gammon
  • 38.9k
  • 13
  • 69
  • 125

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.

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.

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.

Source Link
Nick Gammon
  • 38.9k
  • 13
  • 69
  • 125

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.

AltStyle によって変換されたページ (->オリジナル) /