Serial stops returning data. java.io.IOException: Device not configured in write

Thanks for the quick reply.

In the Processing app, arduinoData and heartbeat are not defined.

I was just showing parts of the Processing app that had anything to do with the Serial. Both of those classes are defined.

It would probably be a good idea to break out of the while loop, if this happens.
Breaking out when you find the \n would be good, too.

So after it reads a \n charcter to put a "break" in the code? Otherwise does it just keep flying around inside of the while loop of the serial read thinking that the serial is available?

What kind of sensors are you reading?

They are just temporary switches. Or whatever you call a switch that closes when its pressed down, and is open when its not pressed. I had a lot of false readings trying to read a HIGH/LOW signal from digital pins in the past, so I just hook them up to an analog pin now and wait for the signal to drop below 10, meaning the switch was hit.

Why are the variables called xSpeed and ySpeed?

Sorry for the confusion. On the Processing end it finds out how many steps should be taken, then sends over a speed value which for the AccelStepper library is the number of steps each motor takes per second.

Thank you for reading the code over so thoroughly.