For some code I am writing I need to be constantly polling a serial port for data to see if an emergency stop button has been pressed on the wireless transmitter.
I was reading about the possibility of sticking this in an interrupt to make the code easier but I understand this is not possible.
Is the best solution to just run:
etc. (XBee being the newsoftserial port name)
at the end of the loop. The loop will be fast enough so that this should be ok.
From fiddling with my XBee, I also have to use XBee.flush(); after each receive to get rid of the old characters. Why is it that you have to do this when using an XBee?