I currently have Arduino code that is either writing 0's or 1's to Serial.println based on the position of a switch. I have confirmed in the Serial Monitor that either a 0 or 1 is being outputted.
I am trying to use Processing to write back to the Arduino based on whether a 0 or 1 is received. The only issue is that Processing is receiving three apparently random numbers repeatably: 10,13, and 49. I have posted my code for both programs below. I realize that the Arduino code is not actually doing anything if it does receive the 'S' at this point. My main issue at this moment is trying to get Processing to read either the 0 or 1. Thank you for your help!
Basically what I am trying to accomplish is a timer that starts when X happens and then stops and reports the elapsed time when Y happens. I am trying to do something simple before adapting the code to work in my main project. I am using millis because I need to record a very fast time.
I know there are similar topics, but none seem to fit exactly what I am doing. Any help is appreciated. Thank you.