Capturing Serial data while processing in a Sub

I would appreciate the community’s help on this basic question below. I have checked the forum for related topics but could not find the same topic.

I have an application where a softSerial port may receive data (40 bytes) while the Photon is processing sensor data inside a Sub (inside its loop()). I do not want to stop the processing in the Sub, but would like to process the data that came in via the softSerial port later.

What is the best way/s of doing so? Is it by using callbacks, interrupts, or simply checking after the Sub is done processing (if Serial(available) …)

Thanks in advance.

ParticleSoftSerial is - just like hardware serial - reading the data into a buffer (64byte) via interrupts. So if you only get 40 bytes between two instances where you can process the entire buffer no special considerations are needed.

Thank you @ScruffR.

1 Like