programming emergency

Please provide some examples of the messages that are being sent to the Arduino.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum

...R